我在vb中建立了一组共五个check控件,我怎样才能判断出那些被选择了,最好知道他们的位置

解决方案 »

  1.   

    Private Sub Command1_Click()
        If Check1.Value Then MsgBox "选择了~!"
    End Sub
    知道他们的位置是什么意思:???
    check1.left 和check1.top吗?!?
      

  2.   

    If Check1.Value Then MsgBox "选择了~!"
      

  3.   

    Private Sub Command1_Click()
    Dim a, b, c, d, e
     a = IIf(Check1.Value = 1, 1, 0)
     b = IIf(Check2.Value = 1, 1, 0)
     c = IIf(Check3.Value = 1, 1, 0)
     d = IIf(Check4.Value = 1, 1, 0)
     e = IIf(Check5.Value = 1, 1, 0)
     MsgBox a & b & c & d & e
    End Sub
      

  4.   

    Option ExplicitPrivate Sub Command1_Click()
        Dim obj As Object
        For Each obj In Me.Controls
            If TypeName(obj) = "CheckBox" Then
                Debug.Print obj.Name + ".value=" + CStr(obj.Value)
            End If
        NextEnd Sub