Hi all -
I am having trouble getting my combobox to populate when i set the datasource to a datatable. I have checked to make sure the datatable has the correct data. I have checked to see if the combobox has any items in it, and it does. When i do ?me.cboMonth.Items.Count in the immediate window, it returns the correct number of items, but i still do not see anything in my dropdown list.
Help, please...anyone. My code is below:
Dim sqliteConStr As String = "DRIVER=SQLite3 ODBC Driver;Database=" & My.Settings.Repository_Path & ";Version=3;NoCreat=True;"
Dim sqliteConn As New Odbc.OdbcConnection(sqliteConStr)
Dim sql As String = "SELECT ID, Month FROM MonthList"
Dim sqliteDA As New Odbc.OdbcDataAdapter(sql, sqliteConn)
dtMonthList = New DataTable("MonthList")
Try
sqliteDA.Fill(dtMonthList)
dtMonthList.CaseSensitive = False
Me.cboMonth.DataSource = dtMonthList
Me.cboMonth.DisplayMember = "Month"
Me.cboMonth.ValueMember = "ID"
Me.cboMonth.SelectedIndex = CInt(Format(Today, "MM")) - 1
Me.txtYear.Text = Format(Today, "yyyy")
Catch ex As Exception
MsgBox(ex.Message)
Me.DialogResult = Windows.Forms.DialogResult.Cancel
End Try
If Not sqliteConn Is Nothing Then sqliteConn.Dispose()
If Not sqliteDA Is Nothing Then sqliteDA.Dispose()
If Not dtMonthList Is Nothing Then dtMonthList.Dispose()
I am having trouble getting my combobox to populate when i set the datasource to a datatable. I have checked to make sure the datatable has the correct data. I have checked to see if the combobox has any items in it, and it does. When i do ?me.cboMonth.Items.Count in the immediate window, it returns the correct number of items, but i still do not see anything in my dropdown list.
Help, please...anyone. My code is below:
Dim sqliteConStr As String = "DRIVER=SQLite3 ODBC Driver;Database=" & My.Settings.Repository_Path & ";Version=3;NoCreat=True;"
Dim sqliteConn As New Odbc.OdbcConnection(sqliteConStr)
Dim sql As String = "SELECT ID, Month FROM MonthList"
Dim sqliteDA As New Odbc.OdbcDataAdapter(sql, sqliteConn)
dtMonthList = New DataTable("MonthList")
Try
sqliteDA.Fill(dtMonthList)
dtMonthList.CaseSensitive = False
Me.cboMonth.DataSource = dtMonthList
Me.cboMonth.DisplayMember = "Month"
Me.cboMonth.ValueMember = "ID"
Me.cboMonth.SelectedIndex = CInt(Format(Today, "MM")) - 1
Me.txtYear.Text = Format(Today, "yyyy")
Catch ex As Exception
MsgBox(ex.Message)
Me.DialogResult = Windows.Forms.DialogResult.Cancel
End Try
If Not sqliteConn Is Nothing Then sqliteConn.Dispose()
If Not sqliteDA Is Nothing Then sqliteDA.Dispose()
If Not dtMonthList Is Nothing Then dtMonthList.Dispose()