private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
switchItem();
}
private void switchItem()
{
var content = richTextBox1;
switch (comboBox1.SelectedValue.ToString())
{
case "Fruit":
content.Text = "Apple";
break;
default:
content.Rtf = "Not Selected";
break;
}
}
As you can see, I'm trying to get the SelectedValue of comboBox1 and this object reference not set to an instance of an object error showed up. What should I do?