Hi everyone
I have a Listview, which when populated, looks something like this :
Always Fresh Flowers 77666666 01/06/2014 Appliance Parts Row 1
Insurance Row 2
-----------------------------------------------------------------------------
Avolands Gauteng 66 01/07/2014 Equipment Hire Row 3
Repairs & Maintenance Row 4
-----------------------------------------------------------------------------
Nicoles Macaroons 6767 01/07/2014 Gas Row 5
-----------------------------------------------------------------------------
Olive Grove 94 15/11/2013 C.O.S. - Food Row 6
C.O.S. - Beverages Row 7
C.O.S. - Other Row 8
-----------------------------------------------------------------------------
Below the Listview I have a number of text boxes which are populated with the contents
of the selected row. This works fine if "Nicoles Macaroons" is selected.
If the "Insurance" row for "Always Fresh Flowers" is selected I need to place "Always Fresh Flowers", "77666666" and "01/06/2014" as well as the word "Insurance" in the Textboxes.
LisyView properties MultiSelect = False
If I click on row 4 then Focuseditem.Index returns the value 0. I need something that will return the value 4 so that I can subtract 1 from it and get SubItems from row 3 *because row 4 does not duplicate the data from the previous row in the interests of readability)
Every attempt that I have made to access one row (or more in the case of Olive Grove) above the selected row has failed.
Can anyone please suggest how I can do this.
Private Sub lsv_View_All_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles lsv_View_All.SelectedIndexChanged
Dim index As Integer = lsv_View_All.FocusedItem.Index
If lsv_View_All.SelectedItems.Count > 0 Then
cbo_ViewAll_Supplier.Text = lsv_View_All.SelectedItems(0).SubItems(1).Text
txt_ViewAll_Invoice_No.Text = lsv_View_All.SelectedItems(0).SubItems(2).Text
dtp_ViewAll_Date.Value = CDate(lsv_View_All.SelectedItems(0).SubItems(3).Text)
cbo_ViewAll_Gl_No.Text = lsv_View_All.SelectedItems(0).SubItems(4).Text
cbo_ViewAll_Vat.Text = lsv_View_All.SelectedItems(0).SubItems(5).Text
txt_ViewAll_Amount.Text = lsv_View_All.SelectedItems(0).SubItems(7).Text
End If
End Sub
Much appreciated
Darrell