I have two windows(forms). In the first window I have a combobox, in the second window I have a button. How do I set the selectedindex of the combobox in windows 1 when the button in window 2 is clicked?
I have tried this without success:
in Window1:
public int OutputCombostr
{
get { return this.OutputCombo.SelectedIndex; }
set { this.OutputCombo.SelectedIndex = value; }
}
In Window2:
private void Button_Click_2(object sender, RoutedEventArgs e)
{
MainWindow firstwindow = new MainWindow();
firstwindow.OutputCombostr = 3;
}