【发布时间】:2015-03-19 20:52:32
【问题描述】:
我是 VB 新手,我需要编写一个程序,在输入框中每输入 100 个符号,就会在列表框中显示一个 @ 符号的条形图。这重复 4 次并四舍五入,这样 440 将给出 4 个 @ 符号,而 450 将给出 5 个 @ 符号。这是我检索每场比赛的出席情况的代码,我只需要帮助形成一个循环,将结果显示到名为lstChart 的列表框中。
Private Sub btnChart_Click(sender As Object, e As EventArgs) Handles btnChart.Click
'Retrieve attendance for game 1
Dim strAttendance1 As Integer
strAttendance1 = InputBox("Enter Attendance for Game #1.", "Chart Input")
If strAttendance1 < 0 Then
MessageBox.Show("Attendance must be greater than zero.", "Error")
End If
'Retrieve attendance for game 2
Dim strAttendance2 As Integer
strAttendance2 = InputBox("Enter Attendance for Game #2.", "Chart Input")
If strAttendance2 < 0 Then
MessageBox.Show("Attendance must be greater than zero.", "Error")
End If
'Retrieve attendance for game 3
Dim strAttendance3 As Integer
strAttendance3 = InputBox("Enter Attendance for Game #3.", "Chart Input")
If strAttendance3 < 0 Then
MessageBox.Show("Attendance must be greater than zero.", "Error")
End If
'Retrieve attendance for game 4
Dim strAttendance4 As Integer
strAttendance4 = InputBox("Enter Attendance for Game #4.", "Chart Input")
If strAttendance4 < 0 Then
MessageBox.Show("Attendance must be greater than zero.", "Error")
End If
【问题讨论】:
标签: vb.net loops listbox inputbox