PS:在做选择题这样的程序时,最好采用数据库编程,就是将题目和答案都放在数据库中,每次执行时,题目都是从数据库中提取,这样即使题目有上百题,VB中只要有一个界面就行了,这样更加方便。
Dim a(20) As IntegerPrivate Sub Form_click()
t = Val(InputBox("输入投票数字"))
Select Case t
Case 1 To 20
a(t) = a(t) + 1
End Select
Me.Cls
For I = 1 To 20
If I Mod 5 = 0 Then
Else
Print Format(I, "00") &":" &a(I) &"次 "
End If
Next
End Sub
Private Sub Form_Load()
Me.AutoRedraw = True
End Sub
Private Sub Command1_Click()
Text1.Text = Val(Text1.Text) + 1
End Sub
Private Sub Command2_Click()
Text2.Text = Val(Text2.Text) + 1
End Sub
Private Sub Command3_Click()
Text3.Text = Val(Text3.Text) + 1
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)