|
If I were attempting this, I would have a function that would set all the values to their defaults (say initForm) and I would just call that from Form1_Load or anywhere else I wanted to reset the form.
For example;
protected void Form1_Load(){
initForm();
...
}
protected void Button1_Click(object sender, EventArgs args){
initForm();
...
}
private void initForm(){
Textbox1.text = "[Default Value]";
Textbox2.text = "[Default Value]";
...
}
If at first you don't succeed ... post it on The Code Project and Pray.
|
|
|
|
|
I would use binding here. Basically, have your data objects contain the default values and use binding on these objects.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Hi,
if the form got designed using Visual Designer, then its constructor starts with an empty Form and populates it by calling InitializeComponent(). You can always:
- remove all the Controls
- call InitializeComponent() again.
To get a fresh looking form without creating a new one.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi everybody I posted this question on sunday & i didnt get an answer..... so I repost it agian... here it is
I am just trying to do some application in C#(like to transfer data from 1 pc to another) from my Network knowledge(up to I have learned),If one of the computer is set not accept connections ,it will not accept data transfers or other connections. So while I was trying to connect to the other PC using C# , is there a way to know such kind of problems or is it possible to open the connection ? If there is something wrong on my question please notify me .
Thank you.
|
|
|
|
|
|
If you just want to call that method from your code, try this.
targetTextBox.Text = GetHostNameByIp ( sourceTextBox.Text ) ;
|
|
|
|
|
Ok!
It´s a code to show me the Host from a Ip and he must get the ip from where!
And how can i add a code to read the Ip from a textbox out?
then the host name should he show me in another textbox or in the same
|
|
|
|
|
The code in the example I gave you should be what you need.
targetTextBox.Text = GetHostNameByIp ( sourceTextBox.Text ) ;
Or try this.
string ipAddress = sourceTextBox.Text ;
string hostName = GetHostNameByIp ( ipAddress ) ;
targetTextBox.Text = hostName ;
This is the same as the single-line example.
|
|
|
|
|
|
thank you for help
|
|
|
|
|
Hello guru's,
I'm experimenting with MVP for a while now and I'm wondering, why in some implementations the model has to know about the view (e.g. WinForms Model View Presenter[^] ).
Why not simply implementing the model as a "subject" (Observer-Pattern) which raises events which are consumed by the views.
Thanks in advance
modified on Monday, August 17, 2009 1:17 PM
|
|
|
|
|
IMNSHO the Model should not necessarily know about the View, So the Delegate/Event methodology (one of the .NET implementations of Observer) is the best way to achieve that.
A lorra, lorra plumbing though.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
MVP has got two variants. Supervising Controller and Passive view. Unlike MVC, a model will not know anything about view in MVP. Like you said, view uses data binding or subscribing to events model raises for displaying the model changes if it is simple. When the display in view is complex, presenter will take care about doing that.
Jeremy Miller explains what's the model here[^]. His building cab series[^] is also worth reading.
|
|
|
|
|
Thank you for your nice answers !
I have another topic. Let me present it in form of a statement.
"It does not harm architecture, if a view has detailed knowledge of the presenter's datastructures (not the app-logic), because the view anyway is totally addicted to the application"
Best regards
|
|
|
|
|
Sorry for this stupid question, but what is a "CAB" and what is "OSS" (both mentioned in the blog of J. Miller)
Thanks
|
|
|
|
|
Hi I have an app with its main form MAIN which is an mdi container.
One of the options from this MAIN is to show a database record in a
new dialog (DIALOG_A).
This new dialog is a mdi child and its mdiparent is MAIN.
Now another operation that MAIN can perform is to create another new
dialog (DIALOG_B).
This also is a child mdi and its mdiparent is MAIN.
However, from DIALOG_B .... i would like to call DIALOG_A also.
I am getting problems however becuause Dialog_A is not an MDI
container.
Could some one suggest some help.
Thank you very much.
|
|
|
|
|
Does call means opening the form? If you can show some code it would be better.
Although you can create the instance of form A and open it using Show method. You can set it's MDI parent as the Main form like this:
FormA frmA = new FormA();
frmA.MDIParent = this.MDIParent;
frmA.Show();
This code would come in the FormB and MDIParent of the FormB should be MainForm.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Hi .. Yes call means -> Instanciate the form.
Thank you.
|
|
|
|
|
In that case the code I had posted should work for you. Or it does not?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Hi ...
Your solution does work.
Many Thanks.
Regards.
Gerry.
|
|
|
|
|
Could you please clarify:
gerrybrennan wrote: from DIALOG_B .... i would like to call DIALOG_A
Does this mean you wish to be able to create a new Dialog_A from Dialog_B, or do you want to Call some function in Dialog_A from Dialog_B?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Yes -> Does this mean you wish to be able to create a new Dialog_A
Thank you.
|
|
|
|
|
If the code from d@nish does not work, please come back, and I will try to help you.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Thank you also Henry
Gerry.
|
|
|
|
|
Are you saying that you want MAIN to launch a new form, DIALOG_B, and make it an MdiChild of MAIN, then DIALOG_B creates a new instance of DIALOG_A and make it an MdiChild of DIALOG_B???
You can't do that. An MdiChild form cannot also be an MdiParent at the same time.
|
|
|
|