VB程序员博客
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
choice()
If Not IsNumeric(TextBox3.Text) Then
MsgBox("Please enter a number…")
ElseIf Val(TextBox3.Text) = Val(TextBox4.Text) Then
Static a As Integer
a = a + 1
Label5.Text = "正确个数:" & a
Label4.ForeColor = Color.Blue
Dim i As Integer = CInt(Int((4 * Rnd()) + 1))
If i = 1 Then
Label4.Text = "Very good!"
End If
If i = 2 Then
Label4.Text = "Excellent!"
End If
If i = 3 Then
Label4.Text = "Nice Work!"
End If
If i = 4 Then
Label4.Text = "Keep up the good work!"
End If
ElseIf Val(TextBox3.Text) <> Val(TextBox4.Text) Then
Static b As Integer
b = b + 1
Label6.Text = "错误个数:" & b
Label4.ForeColor = Color.Red
Dim i As Integer = CInt(Int((4 * Rnd()) + 1))
If i = 1 Then
Label4.Text = "No.Please try again."
End If
If i = 2 Then
Label4.Text = "Wrong.Try once more."
End If
If i = 3 Then
Label4.Text = "Don't give up!"
End If
If i = 4 Then
Label4.Text = "No.Keep trying."
End If
End If
设置一个按钮,点击按钮会弹出msgbox并在其中显示 正确个数占总个数的百分比,也就是像X%,显示完之后正确个数和错误个数全部清零,从新开始。 一定要是在VB2008里运行的~~
谢谢各位了~~~~