Click here to Skip to main content
15,886,771 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI GUYS,

I have combobox in form1 and I need to load combobox values to another form called form2

Can anyone help me to do this?

I tried like this but confused
C#
public string LabelText
{
    get
    {
        return this.lblFO.Text;
    }
    set
    {
        this.lblFO1.Text = value;
    }
}

form2 frm2 = new form2();
frm2.lblFO = this.cmbFO.valuemember;



Thank you
Posted
Updated 26-May-14 18:52pm
v2

use SelectedValue if you need to get the value of the selected item
C#
form2 frm2 = new form2();
frm2.LabelText = this.cmbFO.SelectedValue.ToString();
 
Share this answer
 
First make form2 combobox as public from its property
after that write this code in which event you want

then create object of form2
form2 obj =new form2();
obj.Label1.text=combobox1.SelectedValue.ToString();

I think it will work.
 
Share this answer
 
There are a number of ways to pass value between forms, refer: Passing Data Between Forms[^]
 
Share this answer
 

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