473,568 Members | 2,738 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1279
On Jul 25, 5:40 pm, "Brad Pears" <br...@truenort hloghomes.comwr ote:
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...@truenort hloghomes.comwr ote:
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_newsgroup s" <ro********@yah oo.comwrote in message
news:11******** *************@e 16g2000pri.goog legroups.com...
On Jul 25, 5:40 pm, "Brad Pears" <br...@truenort hloghomes.comwr ote:
>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...@truenort hloghomes.comwr ote:
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_newsgroup s" <rowe_em...@yah oo.comwrote in message

news:11******** *************@e 16g2000pri.goog legroups.com...
On Jul 25, 5:40 pm, "Brad Pears" <br...@truenort hloghomes.comwr ote:
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_newsgroup s" <ro********@yah oo.comwrote in message
news:11******** **************@ l70g2000hse.goo glegroups.com.. .
On Jul 26, 1:36 pm, "Brad Pears" <br...@truenort hloghomes.comwr ote:
>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_newsgrou ps" <rowe_em...@yah oo.comwrote in message

news:11******* **************@ e16g2000pri.goo glegroups.com.. .
On Jul 25, 5:40 pm, "Brad Pears" <br...@truenort hloghomes.comwr ote:
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_newsgroup s" <ro********@yah oo.comwrote in message
news:11******** **************@ l70g2000hse.goo glegroups.com.. .
On Jul 26, 1:36 pm, "Brad Pears" <br...@truenort hloghomes.comwr ote:
>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_newsgrou ps" <rowe_em...@yah oo.comwrote in message

news:11******* **************@ e16g2000pri.goo glegroups.com.. .
On Jul 25, 5:40 pm, "Brad Pears" <br...@truenort hloghomes.comwr ote:
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...@truenort hloghomes.comwr ote:
PS...

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

Brad"rowe_newsg roups" <rowe_em...@yah oo.comwrote in message

news:11******** **************@ l70g2000hse.goo glegroups.com.. .
On Jul 26, 1:36 pm, "Brad Pears" <br...@truenort hloghomes.comwr ote:
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_newsgroup s" <rowe_em...@yah oo.comwrote in message
>news:11******* **************@ e16g2000pri.goo glegroups.com.. .
On Jul 25, 5:40 pm, "Brad Pears" <br...@truenort hloghomes.comwr ote:
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 "UserContro l"

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_newsgroup s" <ro********@yah oo.comwrote in message
news:11******** **************@ b79g2000hse.goo glegroups.com.. .
On Jul 26, 5:57 pm, "Brad Pears" <br...@truenort hloghomes.comwr ote:
>PS...

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

Brad"rowe_news groups" <rowe_em...@yah oo.comwrote in message

news:11******* *************** @l70g2000hse.go oglegroups.com. ..
On Jul 26, 1:36 pm, "Brad Pears" <br...@truenort hloghomes.comwr ote:
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_newsgrou ps" <rowe_em...@yah oo.comwrote in message
>>news:11****** *************** @e16g2000pri.go oglegroups.com. ..
On Jul 25, 5:40 pm, "Brad Pears" <br...@truenort hloghomes.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 "UserContro l"

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
2688
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 http://www.lebans.com/DownloadFiles/A2kTooltip.zip So far the classes work perfectly, except that now I need to extend it to support other controls besides...
2
4079
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 query, I set the 2 primary key values equal to the 2 control values on my form. When I input a value to these 2 controls the query finds the correct...
16
7203
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
4041
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 public/protected methods that I have created (as well a few controls that inheriting forms may use). In my method on form A (public virtual void...
22
2156
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 stage. One approach I have used on other systems is to prevent the action buttons appearing. For example, if one did not have the Role of...
7
2462
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 each with a couple of controls in them I then rebuilt my project and my new panels and all controls they contained are gone... I've looked through...
8
3565
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 picture box, lots of text boxes (for input).. you get the idea. All of a sudden everything on the form has disappeared, it looks like a blank, newly...
15
6492
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 accept other controls. The control i drag drop on it becomes the child of my custom control's parent form and not the child of my custom control. Then...
16
4147
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 therefore being able to modify its properties?
0
7604
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7916
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8117
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7660
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6275
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5498
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2101
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.