I am trying to populate a list view when a user choses a select from a combo box. It goves me nothing when it runs, the list view is blank. The code is below (pos is the selection from the list box which are different table names).
VB Code:
Private Sub getPlayers(ByVal pos As String)
Dim connString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "\db\dbff.mdb"
Dim myConnection As OleDbConnection = New OleDbConnection()
myConnection.ConnectionString = connString
' create a data adapter
Dim da As OleDbDataAdapter = New OleDbDataAdapter("Select * from " & pos, myConnection)
Dim ds As DataSet = New DataSet()
' fill dataset
da.Fill(ds, pos)
Dim dt As DataTable = ds.Tables(pos)
Dim row As DataRow
ListView1.Clear()
ListView1.View = View.Details
' Allow the user to edit item text.
ListView1.LabelEdit = True
'' Allow the user to rearrange columns.
ListView1.AllowColumnReorder = True
'' Display check boxes.
'ListView1.CheckBoxes = True
'' Select the item and subitems when selection is made.
ListView1.FullRowSelect = True
' Display grid lines.
ListView1.GridLines = True
' Sort the items in the list in ascending order.
ListView1.Columns.Add("Player ID", -2, HorizontalAlignment.Left)
ListView1.Columns.Add("Name", -2, HorizontalAlignment.Left)
ListView1.Columns.Add("Price", -2, HorizontalAlignment.Left)
ListView1.BeginUpdate()
For Each row In dt.Rows
Dim itmX As ListViewItem
itmX = ListView1.Items.Add(row("ID"))
itmX.SubItems.Add(row("Name"))
itmX.SubItems.Add(row("Price"))
' colP.Add(row("ID") & row("Name") & ":" & row("Price") & ":" & row("Team") & ":" & row("GamesPlayed") & ":" & row("Completions") & ":" & row("Attempts") & ":" & row("PYards") & ":" & row("TD"), row("id"))
Next
ListView1.EndUpdate()
End Sub