06-03-16, 09:37 PM
اضف هذا الكود
PHP كود :
Private Sub ListBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox2.SelectedIndexChanged
TextBox1.Text = ""
If ListBox2.Text = "" Then Exit Sub
If ListBox2.SelectedIndex = 0 Then
TextBox1.Text &= ListBox2.Items(ListBox2.SelectedIndex) & vbNewLine
TextBox1.Text &= ListBox2.Items(ListBox2.SelectedIndex + 1)
End If
If ListBox2.SelectedIndex = ListBox2.Items.Count - 1 Then
TextBox1.Text &= ListBox2.Items(ListBox2.SelectedIndex - 1) & vbNewLine
TextBox1.Text &= ListBox2.Items(ListBox2.SelectedIndex)
End If
If ListBox2.Items(ListBox2.SelectedIndex - 1).ToString = "" Then
TextBox1.Text &= ListBox2.Items(ListBox2.SelectedIndex) & vbNewLine
TextBox1.Text &= ListBox2.Items(ListBox2.SelectedIndex + 1)
Else
TextBox1.Text &= ListBox2.Items(ListBox2.SelectedIndex - 1) & vbNewLine
TextBox1.Text &= ListBox2.Items(ListBox2.SelectedIndex)
End If
End Sub
