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

Cleariing controls on a form...

P: n/a
I am working on a contract generation application for our log home business.

I have a main form that has many controls on it including tabbed controls,
panes etc...

When the user decides they want to do a new contract, they can click the
"New" button and I will save any changes (if any) - then I want to clear the
form to be ready for them to enter a new contract.

Is there some easy mothod to clear controls on a form - or do I just have
to basically do it manually? I know I can loop through controls on a form
and do it that way but is there not any easier way at all?

Thanks, Brad
Jul 25 '07 #1
Share this Question
Share on Google+
8 Replies


P: n/a
On Jul 25, 5:40 pm, "Brad Pears" <br...@truenorthloghomes.comwrote:
I am working on a contract generation application for our log home business.

I have a main form that has many controls on it including tabbed controls,
panes etc...

When the user decides they want to do a new contract, they can click the
"New" button and I will save any changes (if any) - then I want to clear the
form to be ready for them to enter a new contract.

Is there some easy mothod to clear controls on a form - or do I just have
to basically do it manually? I know I can loop through controls on a form
and do it that way but is there not any easier way at all?

Thanks, Brad
I would say the most performant way would be to write a recursive
function that loops through all the controls and resets the text
property.

Thanks,

Seth Rowe

Jul 25 '07 #2

P: n/a
On Jul 25, 5:40 pm, "Brad Pears" <br...@truenorthloghomes.comwrote:
I am working on a contract generation application for our log home business.

I have a main form that has many controls on it including tabbed controls,
panes etc...

When the user decides they want to do a new contract, they can click the
"New" button and I will save any changes (if any) - then I want to clear the
form to be ready for them to enter a new contract.

Is there some easy mothod to clear controls on a form - or do I just have
to basically do it manually? I know I can loop through controls on a form
and do it that way but is there not any easier way at all?

Thanks, Brad
Oh, I meant to say you also could put all the controls into a seperate
usercontrol which you add to the form. Then when you want to clear all
the fields you could load a new instance of the usercontrol, add it to
the form, and then remove and dispose of the previous instance of the
usercontrol. That should reset all the fields to the designer set
defaults.

Thanks,

Seth Rowe

Jul 25 '07 #3

P: n/a
Hi there... Thanks for that very interesting approach. It sounds
interesting. Could you possibly elaborate a bit on that idea??

What might the separate user control actually be?

Any sample code would be appreciated...

Thanks, Brad

"rowe_newsgroups" <ro********@yahoo.comwrote in message
news:11*********************@e16g2000pri.googlegro ups.com...
On Jul 25, 5:40 pm, "Brad Pears" <br...@truenorthloghomes.comwrote:
>I am working on a contract generation application for our log home
business.

I have a main form that has many controls on it including tabbed
controls,
panes etc...

When the user decides they want to do a new contract, they can click the
"New" button and I will save any changes (if any) - then I want to clear
the
form to be ready for them to enter a new contract.

Is there some easy mothod to clear controls on a form - or do I just
have
to basically do it manually? I know I can loop through controls on a
form
and do it that way but is there not any easier way at all?

Thanks, Brad

Oh, I meant to say you also could put all the controls into a seperate
usercontrol which you add to the form. Then when you want to clear all
the fields you could load a new instance of the usercontrol, add it to
the form, and then remove and dispose of the previous instance of the
usercontrol. That should reset all the fields to the designer set
defaults.

Thanks,

Seth Rowe

Jul 26 '07 #4

P: n/a
On Jul 26, 1:36 pm, "Brad Pears" <br...@truenorthloghomes.comwrote:
Hi there... Thanks for that very interesting approach. It sounds
interesting. Could you possibly elaborate a bit on that idea??

What might the separate user control actually be?

Any sample code would be appreciated...

Thanks, Brad

"rowe_newsgroups" <rowe_em...@yahoo.comwrote in message

news:11*********************@e16g2000pri.googlegro ups.com...
On Jul 25, 5:40 pm, "Brad Pears" <br...@truenorthloghomes.comwrote:
I am working on a contract generation application for our log home
business.
I have a main form that has many controls on it including tabbed
controls,
panes etc...
When the user decides they want to do a new contract, they can click the
"New" button and I will save any changes (if any) - then I want to clear
the
form to be ready for them to enter a new contract.
Is there some easy mothod to clear controls on a form - or do I just
have
to basically do it manually? I know I can loop through controls on a
form
and do it that way but is there not any easier way at all?
Thanks, Brad
Oh, I meant to say you also could put all the controls into a seperate
usercontrol which you add to the form. Then when you want to clear all
the fields you could load a new instance of the usercontrol, add it to
the form, and then remove and dispose of the previous instance of the
usercontrol. That should reset all the fields to the designer set
defaults.
Thanks,
Seth Rowe
The user control would contain any of the controls you want to reset.
It's very simple to create - just copy and paste all the controls and
code-behind into a new user control. Once you add this usercontrol to
your form you can just look at the designer created code to get the
property values that you set in the designer. Then just recreate the
control with these properties when you want to reset the control
values.

Thanks,

Seth Rowe

Jul 26 '07 #5

P: n/a
Ok, I will give that a shot... Thanks for your help...
I may ask more questions. :-)

Brad

"rowe_newsgroups" <ro********@yahoo.comwrote in message
news:11**********************@l70g2000hse.googlegr oups.com...
On Jul 26, 1:36 pm, "Brad Pears" <br...@truenorthloghomes.comwrote:
>Hi there... Thanks for that very interesting approach. It sounds
interesting. Could you possibly elaborate a bit on that idea??

What might the separate user control actually be?

Any sample code would be appreciated...

Thanks, Brad

"rowe_newsgroups" <rowe_em...@yahoo.comwrote in message

news:11*********************@e16g2000pri.googlegr oups.com...
On Jul 25, 5:40 pm, "Brad Pears" <br...@truenorthloghomes.comwrote:
I am working on a contract generation application for our log home
business.
>I have a main form that has many controls on it including tabbed
controls,
panes etc...
>When the user decides they want to do a new contract, they can click
the
"New" button and I will save any changes (if any) - then I want to
clear
the
form to be ready for them to enter a new contract.
>Is there some easy mothod to clear controls on a form - or do I just
have
to basically do it manually? I know I can loop through controls on a
form
and do it that way but is there not any easier way at all?
>Thanks, Brad
Oh, I meant to say you also could put all the controls into a seperate
usercontrol which you add to the form. Then when you want to clear all
the fields you could load a new instance of the usercontrol, add it to
the form, and then remove and dispose of the previous instance of the
usercontrol. That should reset all the fields to the designer set
defaults.
Thanks,
Seth Rowe

The user control would contain any of the controls you want to reset.
It's very simple to create - just copy and paste all the controls and
code-behind into a new user control. Once you add this usercontrol to
your form you can just look at the designer created code to get the
property values that you set in the designer. Then just recreate the
control with these properties when you want to reset the control
values.

Thanks,

Seth Rowe

Jul 26 '07 #6

P: n/a
PS...

By new user control do you mean a new form class?

Brad
"rowe_newsgroups" <ro********@yahoo.comwrote in message
news:11**********************@l70g2000hse.googlegr oups.com...
On Jul 26, 1:36 pm, "Brad Pears" <br...@truenorthloghomes.comwrote:
>Hi there... Thanks for that very interesting approach. It sounds
interesting. Could you possibly elaborate a bit on that idea??

What might the separate user control actually be?

Any sample code would be appreciated...

Thanks, Brad

"rowe_newsgroups" <rowe_em...@yahoo.comwrote in message

news:11*********************@e16g2000pri.googlegr oups.com...
On Jul 25, 5:40 pm, "Brad Pears" <br...@truenorthloghomes.comwrote:
I am working on a contract generation application for our log home
business.
>I have a main form that has many controls on it including tabbed
controls,
panes etc...
>When the user decides they want to do a new contract, they can click
the
"New" button and I will save any changes (if any) - then I want to
clear
the
form to be ready for them to enter a new contract.
>Is there some easy mothod to clear controls on a form - or do I just
have
to basically do it manually? I know I can loop through controls on a
form
and do it that way but is there not any easier way at all?
>Thanks, Brad
Oh, I meant to say you also could put all the controls into a seperate
usercontrol which you add to the form. Then when you want to clear all
the fields you could load a new instance of the usercontrol, add it to
the form, and then remove and dispose of the previous instance of the
usercontrol. That should reset all the fields to the designer set
defaults.
Thanks,
Seth Rowe

The user control would contain any of the controls you want to reset.
It's very simple to create - just copy and paste all the controls and
code-behind into a new user control. Once you add this usercontrol to
your form you can just look at the designer created code to get the
property values that you set in the designer. Then just recreate the
control with these properties when you want to reset the control
values.

Thanks,

Seth Rowe

Jul 26 '07 #7

P: n/a
On Jul 26, 5:57 pm, "Brad Pears" <br...@truenorthloghomes.comwrote:
PS...

By new user control do you mean a new form class?

Brad"rowe_newsgroups" <rowe_em...@yahoo.comwrote in message

news:11**********************@l70g2000hse.googlegr oups.com...
On Jul 26, 1:36 pm, "Brad Pears" <br...@truenorthloghomes.comwrote:
Hi there... Thanks for that very interesting approach. It sounds
interesting. Could you possibly elaborate a bit on that idea??
What might the separate user control actually be?
Any sample code would be appreciated...
Thanks, Brad
"rowe_newsgroups" <rowe_em...@yahoo.comwrote in message
>news:11*********************@e16g2000pri.googlegr oups.com...
On Jul 25, 5:40 pm, "Brad Pears" <br...@truenorthloghomes.comwrote:
I am working on a contract generation application for our log home
business.
I have a main form that has many controls on it including tabbed
controls,
panes etc...
When the user decides they want to do a new contract, they can click
the
"New" button and I will save any changes (if any) - then I want to
clear
the
form to be ready for them to enter a new contract.
Is there some easy mothod to clear controls on a form - or do I just
have
to basically do it manually? I know I can loop through controls on a
form
and do it that way but is there not any easier way at all?
Thanks, Brad
Oh, I meant to say you also could put all the controls into a seperate
usercontrol which you add to the form. Then when you want to clear all
the fields you could load a new instance of the usercontrol, add it to
the form, and then remove and dispose of the previous instance of the
usercontrol. That should reset all the fields to the designer set
defaults.
Thanks,
Seth Rowe
The user control would contain any of the controls you want to reset.
It's very simple to create - just copy and paste all the controls and
code-behind into a new user control. Once you add this usercontrol to
your form you can just look at the designer created code to get the
property values that you set in the designer. Then just recreate the
control with these properties when you want to reset the control
values.
Thanks,
Seth Rowe- Hide quoted text -

- Show quoted text -
No. I mean a UserControl. :-)

Goto Project-->Add New Item and select "UserControl"

A UC is basically a control that holds controls, so you add and
program a UC just like you do a form. The main difference is that a UC
can not be run on it's own, it must first be added to a form.

Thanks,

Seth Rowe

Jul 26 '07 #8

P: n/a
Got ya... Never heard of or used one before. That's why I was confused. Ok,
I will look into it! Thanks for that. I am a complete newbie to the vb.net
world in case you hadn't noticed! :-)

Thanks, Brad
"rowe_newsgroups" <ro********@yahoo.comwrote in message
news:11**********************@b79g2000hse.googlegr oups.com...
On Jul 26, 5:57 pm, "Brad Pears" <br...@truenorthloghomes.comwrote:
>PS...

By new user control do you mean a new form class?

Brad"rowe_newsgroups" <rowe_em...@yahoo.comwrote in message

news:11**********************@l70g2000hse.googleg roups.com...
On Jul 26, 1:36 pm, "Brad Pears" <br...@truenorthloghomes.comwrote:
Hi there... Thanks for that very interesting approach. It sounds
interesting. Could you possibly elaborate a bit on that idea??
>What might the separate user control actually be?
>Any sample code would be appreciated...
>Thanks, Brad
>"rowe_newsgroups" <rowe_em...@yahoo.comwrote in message
>>news:11*********************@e16g2000pri.googleg roups.com...
On Jul 25, 5:40 pm, "Brad Pears" <br...@truenorthloghomes.com>
wrote:
I am working on a contract generation application for our log home
business.
>I have a main form that has many controls on it including tabbed
controls,
panes etc...
>When the user decides they want to do a new contract, they can
click
the
"New" button and I will save any changes (if any) - then I want to
clear
the
form to be ready for them to enter a new contract.
>Is there some easy mothod to clear controls on a form - or do I
just
have
to basically do it manually? I know I can loop through controls on
a
form
and do it that way but is there not any easier way at all?
>Thanks, Brad
Oh, I meant to say you also could put all the controls into a
seperate
usercontrol which you add to the form. Then when you want to clear
all
the fields you could load a new instance of the usercontrol, add it
to
the form, and then remove and dispose of the previous instance of
the
usercontrol. That should reset all the fields to the designer set
defaults.
Thanks,
Seth Rowe
The user control would contain any of the controls you want to reset.
It's very simple to create - just copy and paste all the controls and
code-behind into a new user control. Once you add this usercontrol to
your form you can just look at the designer created code to get the
property values that you set in the designer. Then just recreate the
control with these properties when you want to reset the control
values.
Thanks,
Seth Rowe- Hide quoted text -

- Show quoted text -

No. I mean a UserControl. :-)

Goto Project-->Add New Item and select "UserControl"

A UC is basically a control that holds controls, so you add and
program a UC just like you do a form. The main difference is that a UC
can not be run on it's own, it must first be added to a form.

Thanks,

Seth Rowe

Jul 27 '07 #9

This discussion thread is closed

Replies have been disabled for this discussion.