I'm trying to reference the selected index of a combobox on my mainform in an if statement inside a method on a second form. Some google searching has confused me a bit. The most obvious answer I can see is just making the combobox control on the mainform public, however the websites I've been reading seem to indicate that this is not the prefered method? If this is the case what is the prefered method? I've coded in the secondary constructor method on the second form to accept the first form as a parameter when called, for example:
Form2 form = new Form2(this);
form.Show();
And on the second form:
public partial class Form2 : Form
{
Form1 form1;
public Form2()
{
InitializeComponent();
}
public Form2(Form1 fr1)
{
InitializeComponent();
form1 = new Form1();
form1 = fr1;
So I thought I could just do something like form1.combobox1.SelectedIndex, but no dice....what is the 'community prefered' method to go about doing this?