I tried to constuct a datagrid with some simple cells and some combobox cells.
This what i m trying to do:
I fill all the simple cells from a dataset called "dataset91" but i try to bound to the combobox cell of the datagrid the data from another dataset called "dataset101" and specific the values of a field in "dataset101" called "service code" from the table called "service codes".
"detailcont" is the name of the datagrid.
"contractsn" is the name of the table in the database from witch all the simple cells of the datagrid will be bounded.
The field "service" in dataset91 is a string such as the field "Service code" in dataset101.
Here is the code:
dim tbdet As New DataGridTableStyle
Dim cm As CurrencyManager = BindingContext(detailcont.DataSource, detailcont.DataMember)
Dim connectionstring, selsql As String
connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\mobile\comm.mdb;Mode=Share Deny None;Jet OLEDBatabase Password='hellas'"
Dim dv As DataView = CType(cm.List, DataView)
Me.DataSet91.Tables("contractsn").Clear()
DataSet91.Clear()
detailcont.DataSource = DataSet91.Tables("contractsn")
' OleDbDataAdapter5.Fill(DataSet91)
Dim selread As OleDbDataReader
tbdet.MappingName = "contractsn"
'''
...........................
Dim ComboTextCol As New DataGridComboBoxColumn
ComboTextCol.ColumnComboBox.DropDownStyle = ComboBoxStyle.DropDownList
With ComboTextCol
.MappingName = "service"
.HeaderText = "Service code"
.Width = 100
.ColumnComboBox.DataSource = DataSet101.Tables("Service codes").DefaultView
.ColumnComboBox.DisplayMember = "Service Code"
tbdet.PreferredRowHeight = .ColumnComboBox.Height
End With
tbdet.GridColumnStyles.Add(ComboTextCol)
tbdet.HeaderForeColor = Color.DarkGreen
detailcont.TableStyles.Add(tbdet)
Allthough the combo does not fill?
What may be the problem?
Thank you
This what i m trying to do:
I fill all the simple cells from a dataset called "dataset91" but i try to bound to the combobox cell of the datagrid the data from another dataset called "dataset101" and specific the values of a field in "dataset101" called "service code" from the table called "service codes".
"detailcont" is the name of the datagrid.
"contractsn" is the name of the table in the database from witch all the simple cells of the datagrid will be bounded.
The field "service" in dataset91 is a string such as the field "Service code" in dataset101.
Here is the code:
dim tbdet As New DataGridTableStyle
Dim cm As CurrencyManager = BindingContext(detailcont.DataSource, detailcont.DataMember)
Dim connectionstring, selsql As String
connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\mobile\comm.mdb;Mode=Share Deny None;Jet OLEDBatabase Password='hellas'"
Dim dv As DataView = CType(cm.List, DataView)
Me.DataSet91.Tables("contractsn").Clear()
DataSet91.Clear()
detailcont.DataSource = DataSet91.Tables("contractsn")
' OleDbDataAdapter5.Fill(DataSet91)
Dim selread As OleDbDataReader
tbdet.MappingName = "contractsn"
'''
...........................
Dim ComboTextCol As New DataGridComboBoxColumn
ComboTextCol.ColumnComboBox.DropDownStyle = ComboBoxStyle.DropDownList
With ComboTextCol
.MappingName = "service"
.HeaderText = "Service code"
.Width = 100
.ColumnComboBox.DataSource = DataSet101.Tables("Service codes").DefaultView
.ColumnComboBox.DisplayMember = "Service Code"
tbdet.PreferredRowHeight = .ColumnComboBox.Height
End With
tbdet.GridColumnStyles.Add(ComboTextCol)
tbdet.HeaderForeColor = Color.DarkGreen
detailcont.TableStyles.Add(tbdet)
Allthough the combo does not fill?
What may be the problem?
Thank you