我正試圖解決如何將存儲在標籤中的字符串值乘以ComboBox
中的選定值。我試圖將兩個值都轉換爲int
s,但此錯誤不斷出現:將組合框中選中的值乘以標籤中的數字
無法將類型爲「System.Windows.Controls.ComboBoxItem」的對象轉換爲鍵入「System.IConvertible」。
int quantity = Convert.ToInt32(comboBox3.SelectedItem);
int price = Convert.ToInt32(label1.Content);
label2.Content = quantity*price;
非常感謝
顯示您的代碼,請 – 2013-04-05 21:06:42
如果錯誤表示您正試圖將其轉換爲System.IConvertible,那麼您不會將其轉換爲int。請顯示你的代碼。 – tnw 2013-04-05 21:06:47
問題更新! – user2187795 2013-04-05 21:10:33