I want to get the chosen language from the Form1 combobox and enable other forms to view the language. The combobox has approximately 20 languages.
I have a method called ComboBoxLang_SelectedIndexChanged (occurs when the language in the combobo is changed):
// Works fine in Form1.cs
private void ComboBoxLang_SelectedIndexChanged(object sender, EventArgs e)
string selectedItem = this.comboBoxLang.GetItemText(this.comboBoxLang.SelectedItem);
if (selectedItem == Language.English)
else if (selectedItem == Language.French)
// And so on...
For the moment, to test that it works I just want to display a message of the language chosen in another form. I have researched and have tried multiple ways, but obviously I am going wrong somewhere! For example:
internal string comboBoxVal
But this comes up with an error: "NullReferenceException was unhandled, Object reference not set to an instance of an object".