Hi everyone i've managed to populate a combobox and also show it on datagrid. I had good example from this site
However am kind of stuck on a new problem. when i select the combobox and pick a value it does not hold in the datagrid.
when i click on another cell it goes back to what the value was before.
the Code i've got so far is this....
Could some1 provide me to an insight on how to go bout this. It would really help?
many thanks
However am kind of stuck on a new problem. when i select the combobox and pick a value it does not hold in the datagrid.
when i click on another cell it goes back to what the value was before.
the Code i've got so far is this....
Code:
Dim sql As String
'
sql = "SELECT Drug_ID, DrugName "
sql = sql + "FROM R_Drugs "
sql = sql + "ORDER BY DrugName;"
Dim conn As OleDb.OleDbConnection = New OleDb.OleDbConnection(connectionstring)
Dim mycmd As New OleDb.OleDbCommand(sql, conn)
Dim myadapter As New OleDb.OleDbDataAdapter(mycmd)
Dim dsresults As New DataSet
Dim dtresults As DataTable = dsresults.Tables.Add("DrugIDS")
Dim recordcount As Integer
myadapter.Fill(dsresults, "DrugIDS")
recordcount = dtresults.Rows.Count
Dim cs1 As New CGridComboBoxStyle("Drug_ID")
With cs1
.Width = 200
.Alignment = HorizontalAlignment.Left
.HeaderText = "Drug_ID"
.NullText = ""
.cgCombo.DisplayMember = "DrugIDS.DrugName"
.cgCombo.ValueMember = "DrugIDS.Drug_ID"
.cgCombo.DataSource = dsresults
.cgCombo.DropDownStyle = ComboBoxStyle.DropDownList
End With
CGrid.AddColumn(ts, cs1)
'Set an AlternatingBackColor - just for looks
ts.AlternatingBackColor = Color.LightGoldenrodYellow
'Set the TableStyle for the Grid
CGrid.SetGridStyle(Me.DataGrid1, dt, ts)
Could some1 provide me to an insight on how to go bout this. It would really help?
many thanks