利用单选按钮控件数组,选择一种运算,我的代码不知道哪儿有问题,老提示溢出
Private Sub Option1_Click(Index As Integer)
Dim X As String
Dim Y As String
X = Val(Text1.Text)
Y = Val(Text2.Text)
If Text1.Text <> "" & Text2.Text <> "" Then
Select Case Index
Case 0
Text3.Text = Y / X
Case 1
Text3.Text = Y \ X
Case 2
Text3.Text = Y Mod X
End If
End Select
End Sub
谢谢,我改了之后运行起了,但是为什么启动之后三个单项选择按钮第一个永远都是被选中的呢?如图
追答1、可能是三个Option控件不是数组控件;2、在Form启动中没有选择Option1(0).Value = True默认值;3、在Option1属性窗口查看Value是否是True