Wednesday, May 16, 2012

Calling a combobox from another form

I have a combobox on form1 that I need to call on form2 to get the user selection. Can some one please give me an example on how to do this?



EDIT: Forgot to explain what Im trying to do. I have a readonly textbox....a user clicks edit to edit the text but I want the text they want/chose to edit to pop up right when form2 is called.



I have this code on form1



    public string SelectedComboValue
{
get { return comboBox1.SelectedItem.ToString(); }
}


And this code on form 2



    EDIT: Added Form1 form1 = null; BUT its still not returning the SelectedComboValue
public Form2(Form1 parentForm1) : this()
{
form1 = parentForm1;
}


But it gave me an error saying that form1 is not in this context





No comments:

Post a Comment