0
System.InvalidCastException: Unable to cast object of type 'System.String' to type 'Cookie.Dozen'. at Cookie.CookieSource.listBox1_SelectedIndexChanged(Object sender, EventArgs e) in Form1.cs:line 112
線112以下:爲什麼我得到這個錯誤窗口形式?
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
this.dozen = (Dozen) this.listBox1.SelectedItem;
this.CostChosenLb.ResetText();
}
我想要做的是,當我選擇從列表框中的項目之一,它會在文本框中顯示的價格。但每當我嘗試這樣做時,我都會遇到上述錯誤。幫幫我!
什麼是'this.dozen'的類型 – Hexie