关于控件数组问题,请高人指点下

来源:百度知道 编辑:UC知道 时间:2024/09/18 18:36:41
Private Sub Command1_Click()
Dim i As OptionButton
For Each i In Option1
If Option1(i).Value = True Then
Text1 = Option1(i).Caption
End If
Next
End Sub
麻烦看下该程序错在哪里及如何改正?无需重编新程序!

界面应有一个Option1的单选数组,一个文本框和一个按钮 

程序有一点错误,应写成: 

Dim i As OptionButton 

Dim k As Integer 

For Each i In Option1 

If Option1(k).Value = True Then 

Text1 = Option1(k).Caption 

End If 

k=k+1 

Next 

效果如下: