By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,435 Members | 2,033 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,435 IT Pros & Developers. It's quick & easy.

Clear Multiple controls at the same time

P: n/a
Hello everybody,

I heard I could clear (or move spaces) to all controls at ones without
having to call each one of them. If someone remembers how to do that, I will
apreciate your help.

My scenario is a form where I have multiples groupboxes, and in each of
those groups i have text boxes, where users enter data. And I want to have
an option where the user can clear the controls in particular group at once.
And I do not want to be calling for each one of the controls for that
process.
I used to move spaces to each one of them like this:

text1.text = ""
text2.text=""
text3.text = ""
....
textn.text = ""

but there are a lot of controls in this application.
Thanks for any good suggestions.

Edd
Nov 21 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Eduardo78 wrote:
Hello everybody,

I heard I could clear (or move spaces) to all controls at ones without
having to call each one of them. If someone remembers how to do that, I will
apreciate your help.

My scenario is a form where I have multiples groupboxes, and in each of
those groups i have text boxes, where users enter data. And I want to have
an option where the user can clear the controls in particular group at once.
And I do not want to be calling for each one of the controls for that
process.
I used to move spaces to each one of them like this:

text1.text = ""
text2.text=""
text3.text = ""
...
textn.text = ""

but there are a lot of controls in this application.
Thanks for any good suggestions.

Edd


For each Ctr as Control in GroupBox.Controls
Ctr.Text = ""
Next

This should work.
Chris
Nov 21 '05 #2

P: n/a
Eduardo,

Try this where "me" is your form:

Me.Controls.Clear()

Curtis

"Eduardo78" <Ed*******@discussions.microsoft.com> wrote in message
news:BD**********************************@microsof t.com...
Hello everybody,

I heard I could clear (or move spaces) to all controls at ones without
having to call each one of them. If someone remembers how to do that, I
will
apreciate your help.

My scenario is a form where I have multiples groupboxes, and in each of
those groups i have text boxes, where users enter data. And I want to
have
an option where the user can clear the controls in particular group at
once.
And I do not want to be calling for each one of the controls for that
process.
I used to move spaces to each one of them like this:

text1.text = ""
text2.text=""
text3.text = ""
...
textn.text = ""

but there are a lot of controls in this application.
Thanks for any good suggestions.

Edd

Nov 21 '05 #3

P: n/a
Thanks a lot Chris, it worked good, but it also cleared the labels on that
groupbox, how could I make it to clear just the textboxes?

"Chris" wrote:
Eduardo78 wrote:
Hello everybody,

I heard I could clear (or move spaces) to all controls at ones without
having to call each one of them. If someone remembers how to do that, I will
apreciate your help.

My scenario is a form where I have multiples groupboxes, and in each of
those groups i have text boxes, where users enter data. And I want to have
an option where the user can clear the controls in particular group at once.
And I do not want to be calling for each one of the controls for that
process.
I used to move spaces to each one of them like this:

text1.text = ""
text2.text=""
text3.text = ""
...
textn.text = ""

but there are a lot of controls in this application.
Thanks for any good suggestions.

Edd


For each Ctr as Control in GroupBox.Controls
Ctr.Text = ""
Next

This should work.
Chris

Nov 21 '05 #4

P: n/a
Eduardo78 wrote:
Thanks a lot Chris, it worked good, but it also cleared the labels on that
groupbox, how could I make it to clear just the textboxes?

"Chris" wrote:

Eduardo78 wrote:
Hello everybody,

I heard I could clear (or move spaces) to all controls at ones without
having to call each one of them. If someone remembers how to do that, I will
apreciate your help.

My scenario is a form where I have multiples groupboxes, and in each of
those groups i have text boxes, where users enter data. And I want to have
an option where the user can clear the controls in particular group at once.
And I do not want to be calling for each one of the controls for that
process.
I used to move spaces to each one of them like this:

text1.text = ""
text2.text=""
text3.text = ""
...
textn.text = ""

but there are a lot of controls in this application.
Thanks for any good suggestions.

Edd


For each Ctr as Control in GroupBox.Controls
Ctr.Text = ""
Next

This should work.
Chris


Blah... Ya, sorry about that...

For each Ctr as Control in GroupBox.Controls
if Typeof Ctr is TextBox then
Ctr.Text = ""
End if
Next
Nov 21 '05 #5

P: n/a
Curtis wrote:
Eduardo,

Try this where "me" is your form:

Me.Controls.Clear()

Curtis

"Eduardo78" <Ed*******@discussions.microsoft.com> wrote in message
news:BD**********************************@microsof t.com...
Hello everybody,

I heard I could clear (or move spaces) to all controls at ones without
having to call each one of them. If someone remembers how to do that, I
will
apreciate your help.

My scenario is a form where I have multiples groupboxes, and in each of
those groups i have text boxes, where users enter data. And I want to
have
an option where the user can clear the controls in particular group at
once.
And I do not want to be calling for each one of the controls for that
process.
I used to move spaces to each one of them like this:

text1.text = ""
text2.text=""
text3.text = ""
...
textn.text = ""

but there are a lot of controls in this application.
Thanks for any good suggestions.

Edd



Um, that would remove all the controls from his form... That's not what
he is trying to do.

Chris
Nov 21 '05 #6

P: n/a
Thanks Curtis, but that command clears evething in the form. I just want to
clear the textboxes in a specific groupbox in the form.

Thanks,

Eduardo

"Curtis" wrote:
Eduardo,

Try this where "me" is your form:

Me.Controls.Clear()

Curtis

"Eduardo78" <Ed*******@discussions.microsoft.com> wrote in message
news:BD**********************************@microsof t.com...
Hello everybody,

I heard I could clear (or move spaces) to all controls at ones without
having to call each one of them. If someone remembers how to do that, I
will
apreciate your help.

My scenario is a form where I have multiples groupboxes, and in each of
those groups i have text boxes, where users enter data. And I want to
have
an option where the user can clear the controls in particular group at
once.
And I do not want to be calling for each one of the controls for that
process.
I used to move spaces to each one of them like this:

text1.text = ""
text2.text=""
text3.text = ""
...
textn.text = ""

but there are a lot of controls in this application.
Thanks for any good suggestions.

Edd


Nov 21 '05 #7

P: n/a
Thanks Curtis, but that command clears evething in the form. I just want to
clear the textboxes in a specific groupbox in the form.

Thanks,

Eduardo

"Curtis" wrote:
Eduardo,
"Chris" wrote:
Curtis wrote:
Eduardo,

Try this where "me" is your form:

Me.Controls.Clear()

Curtis

"Eduardo78" <Ed*******@discussions.microsoft.com> wrote in message
news:BD**********************************@microsof t.com...
Hello everybody,

I heard I could clear (or move spaces) to all controls at ones without
having to call each one of them. If someone remembers how to do that, I
will
apreciate your help.

My scenario is a form where I have multiples groupboxes, and in each of
those groups i have text boxes, where users enter data. And I want to
have
an option where the user can clear the controls in particular group at
once.
And I do not want to be calling for each one of the controls for that
process.
I used to move spaces to each one of them like this:

text1.text = ""
text2.text=""
text3.text = ""
...
textn.text = ""

but there are a lot of controls in this application.
Thanks for any good suggestions.

Edd



Um, that would remove all the controls from his form... That's not what
he is trying to do.

Chris

Nov 21 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.