Vb6 在VB中从框架中选择optionbutton

Vb6 在VB中从框架中选择optionbutton,vb6,Vb6,我在from上的每个帧中使用了4个选项按钮。像怀斯一样,我在表格上画了10帧。。现在,我只想在MSaccess数据库中存储每帧中这些选项按钮的值。。因此,数据库中的结果将是每帧10个optionbuttons值。。请帮我解答假设您的问题实际上是如何在组中获取所选选项按钮,那么您需要依次检查每个按钮。 最简单的是: 'Get the selected option from frame 1 If Frame1Option1.Value Then Value1 = 1 ElseIf Frame1

我在from上的每个帧中使用了4个选项按钮。像怀斯一样,我在表格上画了10帧。。现在,我只想在MSaccess数据库中存储每帧中这些选项按钮的值。。因此,数据库中的结果将是每帧10个optionbuttons值。。请帮我解答

假设您的问题实际上是如何在组中获取所选选项按钮,那么您需要依次检查每个按钮。 最简单的是:

'Get the selected option from frame 1
If Frame1Option1.Value Then
  Value1 = 1
ElseIf Frame1Option2.Value Then
  Value1 = 2
ElseIf Frame1Option3.Value Then
  Value1 = 3
ElseIf Frame1Option4.Value Then
  Value1 = 4
End If

'Get the selected option from frame 2
If Frame2Option1.Value Then
  Value2 = 1
ElseIf Frame2Option2.Value Then
  Value2 = 2
ElseIf Frame2Option3.Value Then
  Value2 = 3
ElseIf Frame2Option4.Value Then
  Value2 = 4
End If
如果在每一帧中将它们设置为控件数组,则可以将代码简化为以下内容:

Dim Index As Long

'Get the selected option from frame 1
For Index = Frame1Options.LBound To Frame1Options.UBound
  If Frame1Options(Index).Value Then Value1 = Index
Next
然后,设置它们变得同样简单:

Frame1Options(Value1).Value = True