Reputation: 27
So, I can't figure out how to get the user to be able to retrieve the number of products completed for any day of any week of the month.
After the execution of the 4 weeks are done, the user is prompted to enter the week and the day of the week by InputBox’s that they wish to retrieve information for. Assume that the users enter the day of the week in string format, such as “Monday” or “Tuesday” etc
There would have to be another input box, and that's the thing, I can't figure out how to code it so that the user can chose what day and week by inputting it into the inputbox. Would you have to make 2 input boxes just to retrieve that day and week?
toys(day, 0) = InputBox("Enter what day")
toys(0, week) = InputBox("Enter what week")
Also, I need to get the full sum of the whole array, when you look at the picture, it has the total of 210 and I can't figure out how to get the full sum.
This is the code for the output so far.
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
Here is the expected output.
Upvotes: 0
Views: 1473
Reputation: 802
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
You may have to change number of spaces.
Upvotes: 1