16-01-20, 08:56 PM
ما ذكره الأخ egypt 2020 صحيح
ولكن ضع شرط في الحدث إذا كان الإندكس=-1 فاخرج من الحدث
مثل
ولكن ضع شرط في الحدث إذا كان الإندكس=-1 فاخرج من الحدث
مثل
PHP كود :
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
ListBox1.SelectedIndex = -1
ListBox1.SelectedIndex = 2
End Sub
Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged
If ListBox1.SelectedIndex = -1 Then Return
MsgBox(sender.Text)
End Sub
