HELP! Been trying hard to manually add a DataGridViewRow row WITH a pre-populated combo box... a DataGridViewComboBoxColumn to be exact. I just want to have it automatically populate with strings, shipping options "Ground", "Air", etc. I have gotten so far as to see the first value in the drop down box, but the system says
System.ArguementException: DataGridViewComboBoxCell value is not valid
...and I have never been able to 'drop' the combobox control down (open it up) I want to just make the column, and have it automagically fill with the combobox and its string values, but I have lately been messing around with "DataGridViewComboBoxCell" which I hope I do not ultimately need... THANK YOU I AM STUCK!!!
DataGridViewComboBoxCell myCbox = new DataGridViewComboBoxCell(); //TEST TBD
//
if ((dgvMasterPrinting.Columns == null) || (dgvMasterPrinting.Columns.Count < 1))
{
DataGridViewComboBoxColumn dgcShipType = new DataGridViewComboBoxColumn();
//Column SHIP-TO COMBOBOX
dgcShipType.Name = "colComboShip"; //???
//dgcShipType.DataPropertyName = "colComboShip"; //TEST TBD
dgcShipType.HeaderText = "colComboShip";
dgcShipType.DropDownWidth = 90;
dgcShipType.Width = 90;
dgcShipType.MaxDropDownItems = 5;
dgcShipType.DisplayIndex = 5;
dgcShipType.FlatStyle = FlatStyle.Flat;
myCbox.Items.AddRange("A", "N", "P", "S", "Z");
// dgcShipType.Items.AddRange("A", "N", "P", "S", "Z");
//add the other columns (works fine, only the combo box column has problems)
this.dgvMasterPrinting.Columns.Add(dgcShipType);
}
this.dgvMasterPrinting.Rows.Add(...
I made a simple test: using the designer to make a single DatagridviewComboBoxColumn and add items. Funny that this causes an error: 'theDataGridViewComboBoxCell value is not valid' ...I see talk on the www that there is an inherent MS bug lurking within...