Dim Control As Control
    For Each Control In Me.Controls
        If TypeOf Control Is TextBox Then
            MsgBox Control.Name
        End If
    Next

解决方案 »

  1.   

    把MsgBox Control.Name改成
    Control.text=""就可以清空所有文本框中的文字
      

  2.   

    Private Sub Command1_Click()
    Dim txt As Control
    For Each txt In Me.Controls
      If TypeName(txt) = "TextBox" Then
       txt.Text = ""
      End If
    Next
    End Sub
      

  3.   

    Dim ctrl As Control
    For Each ctrl In Me.Controls
        If TypeName(ctrl) = "TextBox" Then ctrl = ""
    Next
      

  4.   

    Dim Control As Control
        For Each Control In Me.Controls
            If TypeOf Control Is TextBox Then
                MsgBox Control.Name
            End If
        Next