Thursday, 8 August 2013

How to reset panel values after hiding it? C#

How to reset panel values after hiding it? C#

I am working on a small project where I have 2 buttons and 2 panels. panel
1 has TextBox panel 2 has a different TextBox
And there are 2 buttons. When I press button1 panel2 will show, and when I
press button2 panel1 will show. Now let say I type something in panel1's
textbox I want when I move to panel2 and move back to panel1 the textbox
to be empty, just like if I am running the form again. Here are my codes
for the 2 buttons.
This is for the button that will show panel2
private void ShowPanel2_Click(object sender, EventArgs e)
{
Panel Panel2Var = new Panel();
Panel2Var = Panel2;
Panel1.Hide();
Panel2.Show();
}
This is the button that will show panel1
private void ShowPanel1_Click(object sender, EventArgs e)
{
Panel Panel1Var = new Panel();
Panel1Var = Panel1;
Panel2.Hide();
Panel1.Show();
}

No comments:

Post a Comment