搭理读音:帮我看看这段VB代码吧:(为什么不能通过啊)

来源:百度文库 编辑:中科新闻网 时间:2024/05/15 01:42:59
Private Sub Command1_Click()
If (Text3.Text) = Val(Text1) - Val(Text2) Then
'判断学生输入数值与标准答案是否一致
'一致则显示
Label2 = "你真棒!"
Else
'如果答错了,则显示没有答对的提示
Label2 = "请你再想想!"
End If
End Sub

Private Sub Command3_Click()
If (Text6.Text) = Val(Text8) - Val(Text7) Then
'判断学生输入数值与标准答案是否一致
'一致则显示
Label3 = "你真棒!"
Else
'如果答错了,则显示没有答对的提示
Label3 = "请你再想想"
End If
End Sub

Private Sub form_activate()
Randomize
Text1.Text = Int(10 + Rnd * 90)
Text2.Text = Int(10 + Rnd * 90)
End Sub

Private Sub Option1_Click()
If Option1.Value = True Then
Label3.Visible = True
End If
End Sub
Private Sub Option2_Click() '?这段出错了
If Option2.Value = True Then '?这段出错了
Label3.Value = False '?这段出错了

End If
End Sub

我的QQ是591235565 有可能的话帮我通过远控来看看我的这个VB工程吧

1、If (Text3.Text) = Val(Text1) - Val(Text2) Then 这句错,改为
If Val(Text3.Text) = Val(Text1.Text) - Val(Text2.Text) Then
同样,If (Text6.Text) = Val(Text8) - Val(Text7) Then 这句也错了

有几个错误
text 应该是text.text 才能找到文本
label 应该是label.caption 副值文本内容
option 不是value 而是option.caption
建议你去看一下msdn 仔细熟悉一下属性副值和各个控件都有什么属性

Private Sub Command1_Click()
更改后的代码:->>>>>>>>>>>代表此行被更改过,注释除外
If val(Text3.Text) = Val(Text1.text) - Val(Text2.text) Then ->>>>>>>
'判断学生输入数值与标准答案是否一致
'一致则显示
Label2.caption = "你真棒!" ->>>>>>>>>>>>>>>>>>>>>
Else
'如果答错了,则显示没有答对的提示
Label2.caption= "请你再想想!" ->>>>>>>>>>>>>>>>>>>>>
End If
End Sub

Private Sub Command3_Click()
If val(Text6.Text) = Val(Text8.text) - Val(Text7.text) Then ->>>>>>>
'判断学生输入数值与标准答案是否一致
'一致则显示
Label3.caption = "你真棒!" ->>>>>>>>>>>>>>>>>>>>>>>>>>>
Else
'如果答错了,则显示没有答对的提示
Label3.caption = "请你再想想" ->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
End If
End Sub

Private Sub form_activate()
Randomize
Text1.Text = Int(10 + Rnd * 90)
Text2.Text = Int(10 + Rnd * 90)
End Sub

Private Sub Option1_Click()
If Option1.Value = True Then
Label3.Visible = True
End If
End Sub

Private Sub Option2_Click()
If Option2.Value = True Then
Label3.visible = False ->>>>>>>>>>>>>>>>>>>>>>>>>>>>>
End If
End Sub