Hi,
My Access database has one column named 'Term' and the Table name is 'ATG'. I require to populate my listbox with data in the 'Term' columns. I'm unable to do that using this code. Can anyone tell me what's wrong with this (it displays numbers from 1 to 10 and not the database data)
Imports System.Data.OleDb
Public Class Form1
Dim dbConnection As OleDbConnection
Dim dbCommand As OleDbCommand
Dim strInsert As String
Dim dbDataAdapter As OleDbDataAdapter
Dim ConnectString As String = "Provider = Microsoft.Jet.OLEDB.4.0;" & "Data Source =atg.mdb"
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim dtATG As New DataTable
dtATG.Columns.Add("Col1", GetType(Integer))
For i As Integer = 1 To 10
dtATG.Rows.Add(i)
Next
ListBox1.DisplayMember = "Col1"
ListBox1.ValueMember = "Col1"
ListBox1.DataSource = dtATG
End Sub
End Class