473,404 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Cleariing controls on a form...

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
8 1273
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Robert | last post by:
Hello. I have been trying out the Lebans ToolTip Classes at http://www.lebans.com/tooltip.htm, to display "balloon" style help tips in a form. The classes I am using are located at...
2
by: neptune | last post by:
I built a form to access a query with a 2 field primary key. It should use 2 controls to find the unique record and display the other field values on the form. In the criteria section of the...
16
by: TD | last post by:
This is the code under a command button - Dim ctl As Control For Each ctl In Me.Controls If ctl.BackColor <> RGB(255, 255, 255) Then ctl.BackColor = RGB(255, 255, 255) End If Next ctl
3
by: Roger | last post by:
Hi In a Windows forms application I have 2 forms A and B; Form B inherits from form A. Form A is never displayed and its only purpose is to be inherited from and therefore contains mostly...
22
by: Mr Newbie | last post by:
I was thinking about developing a workflow application yesterday and was musing over the different approaches than one could take in restricting specific actions on a ticket( Form ) at any said...
7
by: Mike Bulava | last post by:
I have created a base form that I plan to use throughout my application let call the form form1. I have Built the project then add another form that inherits from form1, I add a few panel controls...
8
by: Ryan | last post by:
Ok.. I have a form with lots of stuff on it; a tool strip panel, menu strip, data binding elements (dataset, binding source, table adapter), tab control with 7 tab pages, each page contains a...
15
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt...
16
by: Mike | last post by:
Hi, I have a form with some controls, and a different class that needs to modify some control properties at run time. Hoy can I reference the from so I have access to its controls and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.