I was wondering, is there a way I can reset all the checkboxes, textboxes, numerics and other controls back to the default values without writing code for every control individually? This is the code I've tried, but doesn't seem to work:
for (int i = 0; i < this.Controls.Count; i++)
{
this.Controls[i].ResetText();
}
EDIT:
I've fixed it by manually setting the control values, sorry for all the trouble >.<.
You can create the form again and dispose the old one.
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnReset_Click(object sender, EventArgs e)
{
Form1 NewForm = new Form1();
NewForm.Show();
this.Dispose(false);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With