J
jaYPee
i have successfully added a combobox control in datagrid. this is the
code i have created but don't show up the record from another table.
Private Sub AddCustomDataTableStyle()
Dim ts1 As DataGridTableStyle
ts1 = New DataGridTableStyle()
ts1.MappingName = "SchYrSemCourseJoin"
' Set other properties.
ts1.AlternatingBackColor = Color.LightGray
Dim ComboTextCol As DataGridComboBoxColumn
ComboTextCol = New DataGridComboBoxColumn()
ComboTextCol.MappingName = "CourseID"
ComboTextCol.HeaderText = "Course"
ComboTextCol.Width = 100
ts1.GridColumnStyles.Add(ComboTextCol)
ts1.PreferredRowHeight =
(ComboTextCol.ColumnComboBox.Height + 3)
With ComboTextCol.ColumnComboBox
.DataSource = DsStudentCourse1
.DisplayMember = "Course.CourseID"
.ValueMember = "Course.CourseID"
End With
' c) set the dropdown style of the combo...
ComboTextCol.ColumnComboBox.DropDownStyle =
ComboBoxStyle.DropDownList
'add the custom table style to the datagrid table styles
DataGrid3.TableStyles.Add(ts1)
End Sub
i would be very glad for any reply...
code i have created but don't show up the record from another table.
Private Sub AddCustomDataTableStyle()
Dim ts1 As DataGridTableStyle
ts1 = New DataGridTableStyle()
ts1.MappingName = "SchYrSemCourseJoin"
' Set other properties.
ts1.AlternatingBackColor = Color.LightGray
Dim ComboTextCol As DataGridComboBoxColumn
ComboTextCol = New DataGridComboBoxColumn()
ComboTextCol.MappingName = "CourseID"
ComboTextCol.HeaderText = "Course"
ComboTextCol.Width = 100
ts1.GridColumnStyles.Add(ComboTextCol)
ts1.PreferredRowHeight =
(ComboTextCol.ColumnComboBox.Height + 3)
With ComboTextCol.ColumnComboBox
.DataSource = DsStudentCourse1
.DisplayMember = "Course.CourseID"
.ValueMember = "Course.CourseID"
End With
' c) set the dropdown style of the combo...
ComboTextCol.ColumnComboBox.DropDownStyle =
ComboBoxStyle.DropDownList
'add the custom table style to the datagrid table styles
DataGrid3.TableStyles.Add(ts1)
End Sub
i would be very glad for any reply...