嗨我有一個代碼讀取文本文件並將內容複製到列表框中。 一切工作正常,但是當我在那裏是沒有項目的地方單擊列表框裏面,會出現一個新的錯誤消息,並指出我的財產以後不對這一行:在列表框中沒有任何選擇時出錯
switch (listBox3.SelectedItem.ToString()) {
case "Accessories":
label4.Text = "None Required"; //Approval
label13.Text = " "; //Approval
label5.Text = "TTS"; //sent by
label6.Text = "IT Co."; //sender
label7.Text = "2"; //urgent
label8.Text = "3"; //normal
label9.Text = "PC Name"; // required filed 1
label10.Text = "PC Brand && Model"; // required filed 2
label11.Text = "B.C"; // required filed 3
label12.Text = "Location"; // required filed 4
label14.Text = "User Name"; // required filed 5
break;
這只是一個一段代碼和編譯器指出的行是這樣的:
switch (listBox3.SelectedItem.ToString())
我該如何解決這個問題?
什麼是編譯器錯誤? – invalidsyntax 2011-06-11 19:14:59