am developing an inventory management system. have two listview controls. one for ITEM and another for details pertaining date, quantity, cost, issued to and so on. i want a vb.net code that if a given item in listview A is clicked, listview B details are cleared and then the details of that item are loaded and displayed on listview B.there is no criteria of loading like between a range of dates; just all records in the database.

Private Sub listview1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles listview1.Click
   If listview1.SelectedItems.Count > 0 Then
      'If listview2 is databound
      listview2.DataSource = Nothing
      'Else
      listview1.Items.Clear()

      PopulateDetailsView(listview1.SelectedItems(0).SubItems(0).Text)
   End If
End Sub

Private Sub PopulateDetailsView(ByVal condition As String)
   Dim SQL As String = "SELECT * FROM table WHERE item = '" & condition & "'"

   'bunch of code to make it happen
End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.