send data from one form to another using combo box-labelMKM.Abdullah Iqbal Khan5yAsked Nov 3, 2020, 6:07 AM672Visual Basic .NETDetails are in picture
Sachin Singh5y agoPosted Nov 3, 2020, 7:01 AM For Windows Form follow below codepublic static string UserType = ""; // global variable in Form1 private void Login_Click(object sender, EventArgs e) { UserType = comboBox1.Text; Form2 frm2 = new Form2(); frm2.Show(); } // form 2 private void Form2_Load(object sender, EventArgs e) { label1.Text = Form1.UserType ; } For Asp.Net WebFormsprivate void Button1_Click (object sender, System.EventArgs e) { string url; url="About.aspx?UserType=" +DropdownList1.SelectedItem.Value ; Response.Redirect(~/About.aspx); } // Destination webform (About.aspx) private void Page_Load (object sender, System.EventArgs e) { Label1.Text=Request.QueryString["UserType"]; }
Sachin SinghPosted Nov 3, 2020, 7:01 AM