Data transfer methods are much easier in ASP.NET (web application) than in C#.NET (Window Based application).
ASP.NET uses their own stateManagement technique
Unlike VB.NET in C#.NET we can not access all forms with it's all controls and values directly.
it can be done using following ways
1. Declear a public veriable at formTwo, see the below code
public string szUserId;
onForm_Load()
{
Label.Text = szUserId;
}
now show FormTwo on click on FormOne
By creating object of FormTwo, we can Access global veriable and assign values to it
FormOne_Button1_Click()
{
FormTwo frmtwo = new FormTwo();
frmtwo.szUserId = txtUserId.Text;
this.Hide();
frmTwo.Show();
}
2. Declear value in constructor on formTwo
string szUserId;
FormTwo (string Uid)
{
Init()
this.szUserId = Uid
}
onForm_Load()
{
Label.Text = szUserId;
}
on FormOne while creating Object of FormTwo pass the userid value
frmtwo = new FormTwo(txtUserId.Text);
frmTwo.Show()