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
I suppose that Form1 is the parent of Form2, so when you create the Form2 you use code like this
then in the Form2 class you should have a declaration like this
and in the Form2 constructor
If this is true then you can call
to get the result required