2
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;
}
}
正如您所看到的,我試圖獲取comboBox1的SelectedValue
,並且此object reference not set to an instance of an object
錯誤出現。我該怎麼辦?正在獲取comboBox1.SelectedValue
所以是這樣的話,太感謝你了:) –