-
Apr 24th, 2006, 09:32 PM
#1
Thread Starter
Member
Back to the previous form
How can I back to the previous form without loosing the data of the previous form.
-
Apr 24th, 2006, 10:19 PM
#2
Re: Back to the previous form
Wow, that's a lot of detail. We don't know anything about how your app is structured so we couldn't really advise without guessing. I suggest that you read the Forms in VB.NET tutorial in my signature. The principles are exactly the same for C# and there are links to code converters in my signature to convert the example code.
-
Apr 25th, 2006, 04:03 AM
#3
Lively Member
Re: Back to the previous form
Sohel,
Put the data of previous form into Session. And retrive those when you came back to that form again....
For example:
Session["data1"] = abc;
Again
text1.text = Session["data1"];
Best of Lucks....
Rajib
Please Rate every reply if it is useful to u
-
Apr 25th, 2006, 08:21 AM
#4
Hyperactive Member
Re: Back to the previous form
Do you want to revert back to the data of the form or the form itself? If its the data you could use some kind of session. If its the form itself, then simply hide the form and when you want to revert back to it, you could re-show the previous form.
-
Apr 25th, 2006, 08:58 AM
#5
Re: Back to the previous form
Eh? Is this a desktop app, or a web app?
If it's a web application, you should post in the ASP.NET forum.
-
Apr 25th, 2006, 10:51 PM
#6
Thread Starter
Member
Re: Back to the previous form
It's a desktop application.
-
Apr 25th, 2006, 10:58 PM
#7
Re: Back to the previous form
Originally Posted by zisohel
It's a desktop application.
You really are a man of few words, aren't you. See how everyone is guessing at what the situation might be? That's because you haven't given enough information. Tell us what you are trying to achieve. "Back to the previous form" could mean a number of different things. We don't know anything about your app so don't assume that we will assume the same things as you. Describe your situation and you'll get more accurate advice. Help us to help you.
Also, have you read that tutorial? I'm quite sure that it will explain what you need to know, plus give you other importatnt information so you won't need to ask many potential questions in the future.
-
Apr 25th, 2006, 11:09 PM
#8
Thread Starter
Member
Re: Back to the previous form
Suppose I have two forms form1 and form2. In form1 user have to put the user id and password. If it is valid then the form2 will appear and form1 should not be visible. After doing the operation at form2 I want to back to the form1 and the user id should be visible in the textbox.
-
Apr 25th, 2006, 11:17 PM
#9
Re: Back to the previous form
That's better
Hide the first form and use ShowDialog() to show the second form, that will wait for it to be dismissed. Then just show self again.
Code:
this.Visible = false;
Form2 theOtherWhatnot = new Form2();
theOtherWhatnot.ShowDialog();
this.Visible = true;
Obviously, you would give things slightly better names than that.
-
Apr 25th, 2006, 11:28 PM
#10
Thread Starter
Member
Re: Back to the previous form
Thanks for your answer. I really want to do that.
-
Apr 25th, 2006, 11:34 PM
#11
Re: Back to the previous form
You'll also need to declare a public property in Form2 to return the user ID. You can then retrieve the value of that property once the dialogue has been dismissed.
Code:
this.Visible = false;
Form2 theOtherWhatnot = new Form2();
if (theOtherWhatnot.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
// Get the user ID from the dialogue. You must defaine the UserID property yourself.
this.TextBox1.Text = theOtherWhatnot.UserID;
}
// You should destroy the dialogue form.
theOtherWhatnot.Dispose()
this.Visible = true;
-
Apr 25th, 2006, 11:36 PM
#12
Re: Back to the previous form
Isn't the user id being inputted in the current form?
-
Apr 25th, 2006, 11:52 PM
#13
Re: Back to the previous form
Originally Posted by penagate
Isn't the user id being inputted in the current form?
Quite correct it seems. I didn't read that last properly. I did ask for it after all. I shouldn't have to read it too. I assumed that there was some desire to pass data between the forms but it would appear not.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|