المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : listBox Item Removal



C# Programming
10-22-2012, 03:16 PM
//My list box contains some empty lines or lines just containing a "\t" and sometimes I want to remove one of these.//If the selected line contains text the line is removed without problem but when the selected line is blank "", " ", or "\t"// the removal goes to the first blank line and removes it rather than the selected line.selLoc = ListBox1.SelectedIndex;listBox1.Items.Remove(listBox1.SelectedItems[0]); // Removes The first occurance of empty line (not selected)// and this is the samelistBox1.Items.Remove(listBox1.Items[selLoc]); // Removes The first occurance of empty line (not selected)//How can I remove a blank selected line?