J
John
Hi,
I've been trying to populate a DataGridViewComboBoxColumn with objects.
The object is defined as :
private struct manufactItem
{
public string name;
public Guid? man_id;
public override string ToString()
{
return name;
}
}
And they are inserted like so :
for (int i = 0; i < ds.Tables["RESULT"].Rows.Count; i++)
{
mi = new manufactItem();
mi.man_id = (Guid)ds.Tables["RESULT"].Rows["MAN_ID"];
mi.name = ds.Tables["RESULT"].Rows["NAME"].ToString();
int pos = (dgvManAlternatives.Columns["ALT_MANUFACTURER"] as
DataGridViewComboBoxColumn).Items.Add(mi);
}
This is all well and good, and when the cell on the grid is clicked the
pulldown list is populated. The problem I am having is when I move out of
the cell, I get
"DataGridViewComboBoxCell value is not valid"
Can I only put string values into the DataGridViewComboBoxColumn?
John.
I've been trying to populate a DataGridViewComboBoxColumn with objects.
The object is defined as :
private struct manufactItem
{
public string name;
public Guid? man_id;
public override string ToString()
{
return name;
}
}
And they are inserted like so :
for (int i = 0; i < ds.Tables["RESULT"].Rows.Count; i++)
{
mi = new manufactItem();
mi.man_id = (Guid)ds.Tables["RESULT"].Rows["MAN_ID"];
mi.name = ds.Tables["RESULT"].Rows["NAME"].ToString();
int pos = (dgvManAlternatives.Columns["ALT_MANUFACTURER"] as
DataGridViewComboBoxColumn).Items.Add(mi);
}
This is all well and good, and when the cell on the grid is clicked the
pulldown list is populated. The problem I am having is when I move out of
the cell, I get
"DataGridViewComboBoxCell value is not valid"
Can I only put string values into the DataGridViewComboBoxColumn?
John.