N
n. Smith
Hi All,
Is it normal that the ListView fires the selectedinexchange event
twice?
I have a LvLoaners list view item that updates 3 text boxes (code
below), when I click on an item. I have set MultiSelect to False.
The first click goes as planned, but all subsqequent clicks seem to
fire the event twice. The first firing triggers an ArgumentException,
resulting in nItem not being initialised. That's why I have the first
Catch Block.
Is this normal, or is something a little goofy?
-nick
Private Sub lvLoaners_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
lvLoaners.SelectedIndexChanged
Try
Dim nItem As Integer = lvLoaners.SelectedIndices(0)
Dim lvItem As ListViewItem = lvLoaners.Items(nItem)
Me.txtEditLoanerName.Text = lvItem.SubItems(0).Text
Me.txtEditLoanerPhone.Text = lvItem.SubItems(1).Text
Me.txtEditLoanerEmail.Text = lvItem.SubItems(2).Text
Catch a As ArgumentException
Return
Catch ex As Exception
MessageBox.Show("Error: " & ex.Message & " in
lvLoaners_SelectedIndexChanged()", "Error")
End Try
Is it normal that the ListView fires the selectedinexchange event
twice?
I have a LvLoaners list view item that updates 3 text boxes (code
below), when I click on an item. I have set MultiSelect to False.
The first click goes as planned, but all subsqequent clicks seem to
fire the event twice. The first firing triggers an ArgumentException,
resulting in nItem not being initialised. That's why I have the first
Catch Block.
Is this normal, or is something a little goofy?
-nick
Private Sub lvLoaners_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
lvLoaners.SelectedIndexChanged
Try
Dim nItem As Integer = lvLoaners.SelectedIndices(0)
Dim lvItem As ListViewItem = lvLoaners.Items(nItem)
Me.txtEditLoanerName.Text = lvItem.SubItems(0).Text
Me.txtEditLoanerPhone.Text = lvItem.SubItems(1).Text
Me.txtEditLoanerEmail.Text = lvItem.SubItems(2).Text
Catch a As ArgumentException
Return
Catch ex As Exception
MessageBox.Show("Error: " & ex.Message & " in
lvLoaners_SelectedIndexChanged()", "Error")
End Try