PDA

Click to See Complete Forum and Search --> : Clear All Textbox


anis_b
Mar 15th, 2003, 09:34 AM
i have few text boxes on my form.

but they are inside one or more group boxes.
means they are directly not placed on the form.

and there are more than one group box on the form

i want to clear all the text boxes.

how do i do that

DevGrp
Mar 15th, 2003, 09:58 AM
you can loop thru the group boxes and set each textbox to an empty string.

Pirate
Mar 15th, 2003, 11:01 AM
try this

Dim c As Control
For Each c In Me.Controls
If TypeOf ctrl Is TextBox Then
c.Text = ""
Next
END if

PT Exorcist
Mar 16th, 2003, 04:23 PM
lol pirate that wont work for what he asked for, he says that the txtboxes are in group boxes then that code simple wont work...what he'll have to do is like the other guy said make a loop thru the form looking for txtboxes and groupboxes..and when he finds groupboxes he will have to make another loop thru all it's controls looking for txtboxes

Pirate
Mar 16th, 2003, 04:38 PM
Sorry, I should read the post carefully next time :rolleyes:

PT Exorcist
Mar 16th, 2003, 04:42 PM
i will forgive u this time, next time i wont be so soft :D

Pirate
Mar 16th, 2003, 04:44 PM
Originally posted by PT Exorcist
i will forgive u this time, next time i wont be so soft :D
lol . :p

MrGTI
Mar 17th, 2003, 09:02 PM
What about making the different sets of TextBoxes into collections (arrays of just TextBoxes)? Wouldn't that work as well?