I have a datagridviewcombobox column, which works well only when the VirtualMode property is false. Otherwise, the value selected from the list will not be displayed in the column. This is added like this
DataGridViewComboBoxColumn colCategory = new DataGridViewComboBoxColumn();
colCategory.Name =
Consts.DATAGRID_CATEGORY;
colCategory.DataPropertyName =
Consts.DATAGRID_CATEGORY;
colCategory.HeaderText =
Consts.DATAGRID_CATEGORY.ToString();
colCategory.SortMode =
DataGridViewColumnSortMode.Automatic;
colCategory.Items.AddRange(
new string[] { "Subsystem", "Library", "Unknown", "Hole" });
this.dgBudgetInfo.Columns.Insert(1, colCategory);
Also, I am generating the serial no automatically like this:
private
void dgBuildFile_NewRowNeeded(object sender, DataGridViewRowEventArgs e)
{
this.dgBuildFile.Rows[this.dgBuildFile.Rows.Count - 1].Cells[0].Value = this.GetNewSlNo();
}
This works only when the VirtualMode property is set to true.
BTW, I cannot take an AutoIncrement column for various other reasons.
Is there any workaround to achieve both of them in the same datagrid?