Results 1 to 3 of 3

Thread: control type check

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2000
    Posts
    168
    is there a property in the control that says what TYPE of control it is? I am using a routine that traps the ACTIVE CONTROL but I only want the routine to run if the active control is a TEXT BOX.. how would someone go about doing that? thanks for the help.

    Thai

  2. #2
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089


    Try something like this.

    Code:
    
    Private Function IsTextBox(obj As Object) As Boolean
    
    Dim objTemp As TextBox
    
    On Error GoTo Err_NotTextbox:
    
    Set objTemp = obj
    
    IsTextBox = True
    
    Exit Function
    
    Err_NotTextbox:
    
    IsTextBox = False
    
    End Function
    this returns true if obj is a text box and false if it isn't
    Hope this helps

  3. #3
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    Dim cntl_Nitro As Control
    Private Sub Form_Load()
    For Each cntl_Nitro In Form1.Controls
    If (Not TypeOf cntl_Nitro Is TextBox) Then
    cntl_Nitro.Font = "Time New Roman"
    cntl_Nitro.Font.Bold = True
    cntl_Nitro.Font.Size = 14
    End If
    Next
    end sub
    Chemically Formulated As:
    Dr. Nitro

Posting Permissions

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



Click Here to Expand Forum to Full Width