Click here to Skip to main content
15,903,854 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,

I am sai shyam. Here i just want to know how to assign a value entered in a textbox to label in the next form.

example: I have 3 windows forms 1st page is login page, second page is a gridview and third form is a button located in a gridview when i click a button the form will open.

Now when i enter a name in login page i.e., username it should be reflected in 3rd form.

Could you please help me out. Thank you.

What I have tried:

in button click i wrote session["username"]=txtusername.text;
and in 3rd form under form load i wrote label.text=session["username"];

But getting error as the name session does not exist in the current context.
Updated 11-Oct-17 1:12am

1 solution

Share this answer
CodeWraith 11-Oct-17 7:30am    
Dang! I hoped you would dig out a more exotic solution. I love to use a message broker for that. Or one form could send out an email and the other form processes incoming mails. Or we could try interprocess communication with the same process on both ends. One form sends, the other one receives. Or...
OriginalGriff 11-Oct-17 7:39am    
Email? Oh dear - the modern theme would be to go retro and use telegrams.
CodeWraith 11-Oct-17 7:43am    
Or messengers on horseback. Pigeons also could work.
OriginalGriff 11-Oct-17 7:47am
CodeWraith 11-Oct-17 8:00am    
What? Have they not been replaced by multicopters that sneak up on you and poke webcams through your window?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900