For example I have Form1 and Form2. Form1 has public property
public IMyCustomType selectedOption;
Inside Form1
there is comboBox
with custom object list. I want when user select option from that combo list to selectedOption populate with that value, like
public IMyCustomType selectedOption;
private void availableChoices_SelectedIndexChanged(object sender, EventArgs e)
{
selectedOption = (IMyCustomType)availableChoices.SelectedItem;
}
Inside Form2
I want to create new instance of that selected type. How to access from form2
to that selectedOption
property and use that value to create new instance?