J
jaYPee
i have successfully added a combobox to my datagrid by setting their
datasource from one of my table. here's my code...
Dim grdColStyle6 As New DataGridComboBoxColumn()
With grdColStyle6
.MappingName = "MajorID" 'must be from the grid
table...
.HeaderText = "Major"
.Width = 120
.ColumnComboBox.DataSource =
DsStudentCourse1.Tables("Major").DefaultView 'dv;
.ColumnComboBox.DisplayMember = "Major"
.ColumnComboBox.ValueMember = "MajorID"
grdTableStyle1.PreferredRowHeight =
..ColumnComboBox.Height + 2
End With
my problem is that i need to add a combobox that contains only two
value called "1st" and "2nd" that when i click the combobox the value
"1st" and "2nd" will appear. so this value is not taken from a table.
i want this only to put in my code...
i tried this code...
With grdColStyle4
.MappingName = "Year" 'must be from the grid table...
.HeaderText = "Year"
.Width = 75
.ColumnComboBox.Items.Add("1st")
.ColumnComboBox.Items.Add("2nd")
.ColumnComboBox.DropDownStyle = ComboBoxStyle.DropDown
grdTableStyle1.PreferredRowHeight =
..ColumnComboBox.Height + 2
End With
but it gives me an error...
An unhandled exception of type 'System.NullReferenceException'
occurred in system.windows.forms.dll
Additional information: Object reference not set to an instance of an
object.
any help is greatly appreciated...
datasource from one of my table. here's my code...
Dim grdColStyle6 As New DataGridComboBoxColumn()
With grdColStyle6
.MappingName = "MajorID" 'must be from the grid
table...
.HeaderText = "Major"
.Width = 120
.ColumnComboBox.DataSource =
DsStudentCourse1.Tables("Major").DefaultView 'dv;
.ColumnComboBox.DisplayMember = "Major"
.ColumnComboBox.ValueMember = "MajorID"
grdTableStyle1.PreferredRowHeight =
..ColumnComboBox.Height + 2
End With
my problem is that i need to add a combobox that contains only two
value called "1st" and "2nd" that when i click the combobox the value
"1st" and "2nd" will appear. so this value is not taken from a table.
i want this only to put in my code...
i tried this code...
With grdColStyle4
.MappingName = "Year" 'must be from the grid table...
.HeaderText = "Year"
.Width = 75
.ColumnComboBox.Items.Add("1st")
.ColumnComboBox.Items.Add("2nd")
.ColumnComboBox.DropDownStyle = ComboBoxStyle.DropDown
grdTableStyle1.PreferredRowHeight =
..ColumnComboBox.Height + 2
End With
but it gives me an error...
An unhandled exception of type 'System.NullReferenceException'
occurred in system.windows.forms.dll
Additional information: Object reference not set to an instance of an
object.
any help is greatly appreciated...