Results 1 to 3 of 3

Thread: Checking ControlType at runtime

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2001
    Posts
    13

    Question Checking ControlType at runtime

    I would like to check for control types at runtime.

    I tried something like this but I get a run-time error 438
    (Object doesn't support this property or method).


    Public Sub ControlTypeTest(frm As Form)

    Dim m_Ctr As Control

    For Each m_Ctr In frm.Controls
    Debug.Print m_Ctr.ControlType
    Next

    End Sub

    How can I do this?


    Thanks in advance




    John,

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Use TypeName instead.
    VB Code:
    1. For Each m_Ctr In frm.Controls
    2.     Debug.Print TypeName(m_Ctr)
    3. Next
    Best regards

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2001
    Posts
    13

    Re TypeName

    That did it.

    Thank you very much

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