hello friends,
i want to know how can i pass the values from one form to other forms.... like i have one combo box and i want to take values at other form... so please tell me how can i pass the values.... its too urgent for me...
thanks in Advance
Loading

Sam HobbsPosted Mar 22, 2010, 9:44 PM
Amit ChoudharyPosted Mar 22, 2010, 6:03 AM
create a constructor of the class where you want to pass the value.. suppose form1 is where you want to navigate with value:
// In form1 cs file
int param;
form1(int i)
{
param=i;
}
now form 2 is your original from where you want to supply the value. so when you open the form1 write like this:
form1 f=new form1(25);
this.Hide();
f.Show();
Please Mark as answer if it helps.
BangaruBabu PuretiPosted Mar 22, 2010, 5:05 AM
Step1: Declare Variables in frmChild1
======================================
Public static String fc1var1="www.c-sharpcorner.com";
Public static String fc1var2="Best Forum Support";
step2: Declare Variables in frmChild2
====================================
public static string getval1fromf1="";
public static string getval2from1="";
step3 :Declare Variables in frmChild3
====================================
public static string getval1fromf1="";
public static string getval2from1="";
step4: Place two Buttons on frmChild1 --one with id(Go2F1) and two with id(Go2F2)
==========================================
UnderGo2F1_Click
----------------
this.Hide();
//Creating Instance for second child form
frmchild2 f2 = new frmchild2();
//Assigning firstChilvariable values to secondchild form values
f2.getval1fromf1=fc1var1;
f2.getval2fromf1=fc1var2;
f2.Show();
UnderGo2F2_Click
----------------
this.Hide();
//Creating Instance for second child form
frmChild3 f3= new frmChild3();
f3.getval1fromf1=fc1var1;
f3.getval2fromf1=fc1var2;
f3.Show();
step5: Know in frmchild2 place two textboxes(say txtname,txtmicusergroup)
==========================================
Under frmchild2_Load (Same as for frmchild3_Load)
--------------------
textname.text=getval1fromf1.ToString();
txtmicusergroup=getval2fromf1.ToString();
Then frmchild2 textbox controls Displays www.csharpcorner.com Best Forum
I hope this will help You
FeedBack Always Expected