Results 1 to 5 of 5

Thread: Checking for existing controls

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2002
    Posts
    1

    Question Checking for existing controls

    hi!
    i want ot know that how can i check at run-time that if my specific control is present then i'll unload it

    otherwise i can receive number of controls on my form at run-time but i cant get their names from which i can unload them

    so any help!

  2. #2
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    So you want to count how many controls are on your form ?
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  3. #3
    khalik
    Guest
    VB Code:
    1. Private Sub Command1_Click()
    2. Dim tx As Variant
    3. MsgBox Form1.Controls.Count
    4. For Each tx In Form1.Controls
    5.     MsgBox tx.Name
    6. Next
    7. End Sub

    this should help u... count and properties...

  4. #4
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Originally posted by khalik
    VB Code:
    1. Private Sub Command1_Click()
    2. Dim tx As Variant
    3. MsgBox Form1.Controls.Count
    4. For Each tx In Form1.Controls
    5.     MsgBox tx.Name
    6. Next
    7. End Sub

    this should help u... count and properties...
    heh you beat me to it

    VB Code:
    1. Private Sub Form_Load()
    2.     Dim x As Object
    3.     For Each x In Form1.Controls
    4.         MsgBox x.Name
    5.     Next
    6. End Sub
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  5. #5
    khalik
    Guest
    Originally posted by plenderj


    heh you beat me to it

    VB Code:
    1. Private Sub Form_Load()
    2.     Dim x As Object
    3.     For Each x In Form1.Controls
    4.         MsgBox x.Name
    5.     Next
    6. End Sub

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