Hi I have a code that reads a text file and copies the content into a list box.
Everything is working fine, but when I click inside the listbox in a place where there is no item, a new error message appears and it points out that I have somthing wrong with this line:
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;
This just a piece of the code and the line which the compiler points out is this:
switch (listBox3.SelectedItem.ToString())
How can I fix this issue?
try this fix: