Hi,
I am having throuble resetting my textboxes to nothing if the selection in the listview is nothing. I.e. when i select a record my textboxes are updated with teh selected data, but if nothing is selected after something is selected I would like to clear the textboxes to blank again.
Here is what i have. (i have the 3 extra sections in there and have been trying to get it to work so any help would be appreciated.
Private Sub ListViewSelection()
If lvLocations.SelectedItems.Count > 0 Then
Dim list As ListViewItem = lvLocations.SelectedItems(0)
If list.SubItems.Count >= 1 Then
If list.SubItems(1).Text <> "" Then
tbLineNo.Text = list.Index.ToString
tbID1.Text = list.Text
tbID2.Text = list.SubItems(1).Text
tbDPID.Text = list.SubItems(2).Text
ElseIf list.SubItems(0).Text = "" Or list.SubItems(1).Text = "" Or list.SubItems(2).Text = "" Then
tbLineNo.Text = list.Index.ToString
tbID1.Text = ""
tbID2.Text = ""
tbDPID.Text = ""
ElseIf list.Selected = False Then
tbLineNo.Text = list.Index.ToString
tbID1.Text = ""
tbID2.Text = ""
tbDPID.Text = ""
ElseIf list.SubItems.Count = 0 Then
tbLineNo.Text = list.Index.ToString
tbID1.Text = ""
tbID2.Text = ""
tbDPID.Text = ""
End If
Else
MsgBox("Incomplete")
End If
Else
MsgBox("Incomplete")
End If
End Sub