Q:

Populating a ListView Inside a Tab Control in VB 2010

I am pretty new in Visual Basic. I have a tab control in my form and inside it I put a listview. What I wanted to do is populate the listview everytime I clicked on each tab. But I don't know how to do it. 
Can anyone please help me?
Here is the bit of my code
Public Class Form2

    Private Sub PopulateRecords()
        Dim TSR As New ADODB.Recordset
        Dim STRSQL As String = ""
        STRSQL &= "SELECT * from Records " & vbCrLf
        STRSQL &= "WHERE (Customer_name like '" & TextBox1.Text & "%' or Item_name like '%" & TextBox1.Text & "%' or Item_code like '%" & TextBox1.Text & "%' or Price like '%" & TextBox1.Text & "%' or Qty like '%" & TextBox1.Text & "%' or Total_price like '%" & TextBox1.Text & "%' or Date_started like '%" & TextBox1.Text & "%' or Date_finish like '%" & TextBox1.Text & "%')" & vbCrLf
        STRSQL &= "order by Customer_name, Item_name" & vbCrLf
        TSR.Open(STRSQL, CNN, 1, 3)
        ListView1.Items.Clear()
        While Not TSR.EOF
            ListView1.Items.Add(TSR.Fields("Customer_name").Value)
            ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(TSR.Fields("Item_name").Value)
            ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(TSR.Fields("Item_code").Value)
            ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(TSR.Fields("Price").Value)
            ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(TSR.Fields("Qty").Value)
            ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(TSR.Fields("Total_price").Value)
            ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(TSR.Fields("Date_started").Value)
            ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(TSR.Fields("Date_finish").Value)
            ListView1.Items(ListView1.Items.Count - 1).SubItems.Add(TSR.Fields("ID").Value)
            TSR.MoveNext()
        End While
        TSR.Close()
    End Sub

    Private Sub TabPage1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage1.Click
        Call PopulateRecords()
    End Sub

End Class

A:

You should try responding to the SelectedIndexChanged event on the parent (the TabControl). This is fired when the user moves between tabs.  TabPage.Click is fired when the page itself is clicked upon - not when the tab is changed to.

