VB初学者请教关于复选框的问题,我的代码错了哪里,为什么运行不出结果
Private Sub Check1_Click()If Check1.Value = 1 Then
a = Val(Text1.Text)
Else
a = 0
End If
End Sub
Private Sub Check2_Click()
If Check2.Value = 1 Then
b = Val(Text2.Text)
Else
b = 0
End If
End Sub
Private Sub Check3_Click()
Dim s As Integer
If Check3.Value = 1 Then
c = Val(Text3.Text)
Else
c = 0
End If
End Sub
Private Sub Check4_Click()
If Check4.Value = 1 Then
d = Val(Text4.Text)
Else
d = 0
End If
End Sub
Private Sub Check5_Click()
If Check1.Value = 1 Then
e = Val(Text5.Text)
Else
e = 0
End If
End Sub
Private Sub Command1_Click()
s = a + b + c + d + e
Text6.Text = s
End Sub
Private Sub Text1_LostFocus()
If a < 0 Or a > 100 Then
Text1.Text = ""
Text1.SetFocus
Else
a = Val(Text1.Text)
Text2.SetFocus
End If
End Sub
Private Sub Text2_LostFocus()
If b < 0 Or b > 100 Then
Text2.Text = ""
Text2.SetFocus
Else
b = Val(Text2.Text)
Text3.SetFocus
End If
End Sub
Private Sub Text3_LostFocus()
If c < 0 Or c > 100 Then
Text3.Text = ""
Text3.SetFocus
Else
c = Val(Text3.Text)
Text4.SetFocus
End If
End Sub
Private Sub Text4_LostFocus()
If d < 0 Or d > 100 Then
Text4.Text = ""
Text4.SetFocus
Else
d = Val(Text4.Text)
Text5.SetFocus
End If
End Sub
Private Sub Text5_LostFocus()
If e < 0 Or e > 100 Then
Text5.Text = ""
Text5.SetFocus
Else
e = Val(Text5.Text)
End If
End Sub
Private Sub Text6_Change()
End Sub