Results 1 to 4 of 4

Thread: scanning all [control name] on a tab [RESOLVED]

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489

    scanning all [control name] on a tab [RESOLVED]

    I didn't know how to look this one up to search, so if it's been answered, forgive me.

    Let's say I have several text boxes on a tab and a button that is supposed to clear them. Instead of writing code to set each boxes.text property to " ", can there be a for ... next loop used?

    I remember a thread asking about this but all I knew to answer was write out the code for each box.
    Last edited by Andy; Mar 25th, 2004 at 10:17 PM.

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    VB Code:
    1. Public Sub ClearAllTabTextBoxes(ByVal tab As TabPage)
    2.         For Each ctrl As Control In tab.Controls
    3.             If TypeOf ctrl Is TextBox Then
    4.                 ctrl.Text = String.Empty
    5.             End If
    6.         Next
    7.     End Sub
    8.  
    9. 'syntax
    10. ClearAllTabTextBoxes(TabPage1)

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489
    thanks edneesis! that worked well. what if the text boxes are within groupbox?

  4. #4
    Addicted Member Hole-In-One's Avatar
    Join Date
    Mar 2003
    Location
    Minnesota
    Posts
    195
    search the tabpages for groupboxes, then search the groupboxes for textboxes!

    Just modify Edneeis's code.

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