因此,我无法弄清楚如何让用户能够检索当月任何一周中任何一天完成的产品数量。
完成4周的执行后,系统会提示用户输入他们希望检索信息的InputBox的星期和星期几。假设用户以字符串格式输入星期几,例如“星期一”或“星期二”等
必须有另一个输入框,这就是事情,我无法弄清楚如何对其进行编码,以便用户可以通过将其输入到输入框中来选择日期和星期。您是否需要制作2个输入框才能检索该日和周?
toys(day, 0) = InputBox("Enter what day")
toys(0, week) = InputBox("Enter what week")
另外,我需要获得整个数组的全部总和,当你看到图片时,它总共有210个,我无法弄清楚如何获得全部总和。
这是迄今为止的输出代码。
Private Sub btnExecute_Click(sender As Object, e As EventArgs) Handles btnExecute.Click
Dim toys(4, 3) As String
For week As Integer = 0 To 3
For day As Integer = 0 To 4
toys(day, week) = InputBox("Please enter value for Day " & CStr(day + 1) & " in week " & CStr(week + 1) & ".", "Enter Value", (value + 1))
Next day
Next week
txtOutput.Text &= vbTab + "Mon" + vbTab + "Tue" + vbTab + "Wed" + vbTab + "Thur" + vbTab + "Fri" + vbCrLf
For week As Integer = 0 To 3
txtOutput.Text &= "Week " + (week + 1).ToString + " "
For day As Integer = 0 To 4
txtOutput.Text += vbTab + toys(day, week)
For i = 0 To 10 - toys(day, week).Length
txtOutput.Text += " "
Next
If day = 4 Then
txtOutput.Text &= vbCrLf
End If
Next
Next
End Sub
这是预期的输出。
答案 0 :(得分:1)
Private Sub btnExecute_Click(sender As Object, e As EventArgs) Handles btnExecute.Click
Dim toys(4, 3) As String
For week As Integer = 0 To 3
For day As Integer = 0 To 4
toys(day, week) = "..."
Next day
Next week
txtOutput.Text &= " Mon" + vbTab + "Tue" + vbTab + "Wed" + vbTab + "Thu" + vbTab + "Fri" + vbCrLf
For week As Integer = 0 To 3
txtOutput.Text &= "Week " + (week + 1).ToString + " "
For day As Integer = 0 To 4
txtOutput.Text += toys(day, week)
For i = 0 To 10 - toys(day, week).Length
txtOutput.Text += " "
Next
If day = 4 Then
txtOutput.Text &= vbCrLf
End If
Next
Next
End Sub
您可能需要更改空格数。