Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Other Development Tools
 [VB 2010] populate ComboBox with Acces DB queries

Author  Topic 

iboumiza
Starting Member

9 Posts

Posted - 2011-12-08 : 00:54:51
Hi, this is the code I use to populate 3 combobox, but I just get only the first row in each combobox...

and I want also cboBox3 depend from cboBox2 depends from cboBox1, how can I do it?


[CODE]
Imports System.Data
Imports System.Data.OleDb

Public Class frm

Dim objConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source = DBSOURCE\DB.mdb;Jet OLEDB:Database Password=pass;")

Dim objdataadapter As New OleDbDataAdapter("SELECT * FROM table", objConnection)
Dim objdataset As DataSet
Dim objdataview As DataView

Private objcurrencymanager As CurrencyManager
Private Sub userTableOptions()
'objdataadapter = New OleDbDataAdapter

objdataset = New DataSet
objdataadapter.Fill(objdataset,"staff")
objdataview = New DataView(objdataset.Tables("staff"))

' objcurrencymanager = CType(Me.BindingContext(objdataview), CurrencyManager)

End Sub

Private Sub attachtextsuser()

cboBox1.DataBindings.Clear()
cboBox2.DataBindings.Clear()
cboBox3.DataBindings.Clear()
cboBox1.DataBindings.Add("text", objdataview, "location")
cboBox2.DataBindings.Add("text", objdataview, "director")
cboBox3.DataBindings.Add("text", objdataview, "seller")

End Sub

Private Sub frm_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

userTableOptions()
attachtextsuser()

End Sub

End Class[/CODE]
   

- Advertisement -