hi,
I want to write a function filling the combo box with dynamic biniding of combobox in base form
I have to fill the userLevel in the first combo and user name in the second combo as per levelhow to fill the combo box with the dynamic table creation.
?? how should the dispalymember , datamember of a combo box can be called?? How to fill the table ...how to fetch data where "??" is used...
The code goes like ...
'' How to fill the table ... ??
'' how to bind the combo box ??
'Connection
oledbConnection = New OleDb.OleDbConnection oledbConnection.ConnectionString = "User ID=sa;Data Source=SHANMUGARAJ;pwd=raja;Tag with column collation when possible=False;" & _ "Initial Catalog=Money;Use Procedure for Prepare=1;Auto Translate=True;Persist Se" & _ "curity Info=False;Provider=""SQLOLEDB.1"";Workstation ID=SHANMUGARAJ;Use Encryptio" & _ "n for Data=False;Packet Size=4096"
oledbConnection.Open()
'Define Dynamic Dataset , Table , column , row Dim ds As New DataSet Dim dt As New DataTable Dim dcD As New DataColumn Dim dcV As New DataColumn Dim dtR As DataRow
ds.Tables.Add(dt) dt.Columns.Add(dcD) dt.Columns.Add(dcV)
'Adaptor , Command Dim oleAdap As New OleDb.OleDbDataAdapter Dim oleCmd As New OleDb.OleDbCommand oleCmd.Connection = oledbConnection oleCmd.CommandText = "select Ulevel from UserLevel" '' The qry must be sent via function oleAdap.SelectCommand = oleCmd oleAdap.Fill(dt)
'' How to fill the table ... ?? With dt dtR = ds.Tables(0).NewRow dtR.BeginEdit() dtR.Item(0) = ?? dtR.Item(1) = ?? dtR.EndEdit() End With
'' how to bind the combo box ?? ' '' The combobox must be sent via function
'setCombo with values
With combobox .DataSource = ds.Tables("dt") .DisplayMember = ?? .ValueMember =?? End With
cboLevel.SelectedIndex = -1
oledbConnection.Close()