很久没用vb了,手头也没有vb,我试试看!
Private Sub Command2_Click()
    Dim cnl As Control
    
    For Each cnl In Controls
        If cnl Is TextBox Then MsgBox cnl.Name
    Next
End Sub
或者
Private Sub Command2_Click()(估计这个不对)
    Dim cnl As Control
    
    For Each cnl In Controls
        If cnl.type=TextBox Then MsgBox cnl.Name
    Next
End Sub

解决方案 »

  1.   

    换个角度说,能不能获取一个Form中的同一种控件,
    比如TextBox控件。
      

  2.   

    Dim obj As Control
    For Each obj In Me
        If TypeOf obj Is TextBox Then
           MsgBox "i love you"
        End If
    Next
      

  3.   

    要用到api函数getclassname看它是不是edit
      

  4.   

    可以的:
    For Each x In Me.Controls
        If TypeOf x Is TextBox Then
            MsgBox (x.Name)
        End If
    Next