Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Gillingham, Kent, England
    Posts
    511
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Find a controls type (VB6)

    Im trying to identify what type a control is. I know its possible as i've seen it before, but I can't remember and I can't seem to find out the answer.
    My sample code is as follows, I know .type is incorrect, but its just an example of what im after.

    For Each ctl In frmAccountRecords
    Debug.Print ctl.typename
    Next ctl

    Ill adapt the functions so if the type is a Textbox, I can populate the .text, but if its a label I can populate the .caption

    Any help would be much appreciated.

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Find a controls type (VB6)

    Like this:

    For Each ctl In frmAccountRecords.Controls
    Debug.Print TypeName(ctl)
    Next ctl
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  3. #3
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Gillingham, Kent, England
    Posts
    511
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Find a controls type (VB6)

    Excellent, thanks Jan, that'll be the one!

    I was almost there, it wasn't a bad guess from memory.

    Thanks again, working like a dream now.

Posting Permissions

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