Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2006
    Posts
    47

    Unanswered: type of control is textbox

    i would like to iterate my controls and if its a textbox check a value

    i have :

    Dim txt As Control

    For Each txt In Me.Controls
    If txt Is TextBox Then <-- wrong, how can i check?

    If txt.Tag = "r" Then

    If Len(Trim(txt.Text)) = 0 Then
    txt.Text = "Required Field"
    txt.Interior.Color = vbYellow
    bRequired = False
    End If
    End If
    End If
    Next

  2. #2
    Join Date
    Mar 2006
    Posts
    163
    There are 2 ways.
    Code:
     If TypeOf txt Is MSForms.TextBox Then
    Code:
    If TypeName(txt) ="TextBox" Then

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •