Hi i'm doing an application that have a form i use it for imput data in a database, i like that after event buttun_click the form return as it was before the interaction of customer.
Now i close and re-open the form but is possible that no exists another method to do this
Sorry for my english but i don't have opportunity to write in this language.
![]()

how can i reset form's controls
Mike_Donner
Im not sure what you are trying do.
try Application.Restart();
joru
Oliver77
Essentially, you need a "Reset" function.
e.g. If a textbox starts off with a text property value of "Begin," after the user makes changes to the text box and an event is fired that causes a reset to take place, in the reset function you'd need to simply set it back to "Begin".
One simple way to do this would be to use th "Tag" property of controls. Have the tag property store the initial value when the form begins. When user hits reset, just reinitialize the controls property display value to the value in the Tag property.
MrHayes
Sorry for late reply.
Assuming that the active form is "FmyForm.cs"
try this in your event / after user input
this.Hide();
FmyForm form = new FmyForm();
form.ShowDialog();
I use this code to reset my form
hope it works
amandeep
Rizak the Really Horrible
for (int i = 0; i < this.Controls.Count; i++)
{
this.Controls
}
/* Iterate through Form Controls , and by using the ResetText() Function will set the text of all the controls to its default value */
Hope this might help
Soul
VB code:
For Each Controllo In TabPage1.Controls ' for form in action Me.Controls If Controllo.GetType.ToString.Equals("System.Windows.Forms.TextBox") ThenTexBox = Controllo
TexBox.Test =
"" End If Nextmepatuhoo
for (int i = 0; i < this.Controls.Count; i++)
{
this.Controls[ i ].ResetText();
}
/*Iterate through Form Controls, and by using the ResetText() Function will set the text of all the controls to its default value*/
Hope this might help
Marcelo - MSFT
I try to explain my problem with more clearly:
I have a form with texbox, combobox ecc... i like that after an event the form return as it was when it was opened
sorry i use vb.2005