在一个frame中放置3个option按钮和一个Button按钮
在ButtonClick事件中写代码。用Select case语句
    select case ?(不知道怎么写)
      case 1:
      case 2:
      case 3:

解决方案 »

  1.   

    if optionname.check=true then 
      ...
    else
     ...
    end if
      

  2.   

    得一个一个去判断。如果 option按钮 是数组可以简化一些.
      

  3.   

    select case 后面应该是Integer类型,怎么写?
      

  4.   

    窗体上先放置第一个option,选择这个option右击选择复制,然后粘贴,这时候会问你是否创建控件数组,选择是。如此重复几次就可以得到由几个option组成的空间数组,当然,每个option的属性你都能单独设置。
    假设你的窗体上一共有3个optionPrivate Sub Command1_Click()
        Dim i As Integer        '循环计数变量
        Dim Index As Integer    '被选中的option的索引号
        For i = 0 To Option1.Count - 1
            If Option1(i).Value = True Then Index = i
        Next
        Select Case Index
            Case 0
                MsgBox "第一个"
            Case 1
                MsgBox "第二个"
            Case 2
                MsgBox "第三个"
        End Select
    End Sub
      

  5.   

    Private Sub Command1_Click()
        Dim a As Object
        For Each a In Me.Controls
            If TypeName(a) = "OptionButton" Then
                If a.Value = True Then
                    Select Case a.Name
                    Case "Option1"
                        MsgBox "123"
                    Case "Option2"
                        MsgBox "234"
                    Case "Option3"
                        MsgBox "abc"
                    End Select
                End If
            End If
        Next
    End Sub