|
-
Feb 12th, 2004, 04:44 PM
#1
Thread Starter
Frenzied Member
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.
-
Feb 12th, 2004, 05:19 PM
#2
VB Code:
Public Sub ClearAllTabTextBoxes(ByVal tab As TabPage)
For Each ctrl As Control In tab.Controls
If TypeOf ctrl Is TextBox Then
ctrl.Text = String.Empty
End If
Next
End Sub
'syntax
ClearAllTabTextBoxes(TabPage1)
-
Feb 13th, 2004, 11:24 AM
#3
Thread Starter
Frenzied Member
thanks edneesis! that worked well. what if the text boxes are within groupbox?
-
Feb 13th, 2004, 10:14 PM
#4
Addicted Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|