private void btnback1_Click(object sender, EventArgs e)
{
firstpage first = new firstpage();
first.Show();
this.Hide();
}
I tried this way of redirecting but when i pressed back,the stuff that I typed (in previous page)is all gone.
private void btnback1_Click(object sender, EventArgs e)
{
firstpage first = new firstpage();
first.Show();
this.Hide();
}
I tried this way of redirecting but when i pressed back,the stuff that I typed (in previous page)is all gone.
The problem is that you are creating the new object of the first page and then making it show.
So the solution is
Solution 1: If possible maintain the object of the first page.
or
Solution 2: If possible assign value to all the controls again after creating page.
You have firstpage first = new firstpage();
, which initializes a new instance with default values. This is why you are not getting your old values back. I would advise you to keep your values stored somewhere (a global singleton or something) so you can set them again, or keep a reference to the first page somewhere and call it's Show()
method instead of creating a new one. Both ways have pros and cons, but it's up to you to choose which one you will use.