这个VB程序错哪里啊

来源:百度知道 编辑:UC知道 时间:2024/06/07 22:06:21
private sub command1_click() if optionbutton1.value=true then if optionbutton3.value=true then text1.text="坐飞机去上海"else text1.text="坐飞机去西安" end if else if optionbuton.value=true then text1.text="坐火车去上海"else text1.text="坐火车去西安" end ifend ifend sub

Private Sub command1_click()

If optionbutton1.Value = True Then

If optionbutton3.Value = True Then

Text1.Text = "坐飞机去上海"

Else

Text1.Text = "坐飞机去西安"

End If

Else

'我看不出什么东西来
'下面的 optionbuton 会不会有问题?
'是 optionbutton ?
If optionbuton.Value = True Then

Text1.Text = "坐火车去上海"

Else

Text1.Text = "坐火车去西安"

End If

End If

End Sub

完全没有大括号。
if语句嵌套看不清前因后果。

而且,你的if和end if 数目不对。
else if 不能算if的。

或许是由于看不清的关系,这个判断式总是很奇怪。optionbutton1选中并且optionbutton3选中 或者,optionbutton选中的情况下,去上海。
其他情况去西安。
这么麻烦干嘛?

if optionbuton.value=true then '这句optionbuton后面没有数字吗?

Private Sub comm