i am binding a datagridview from custom datatable. i want a particular datacel 开发者_开发技巧to be of combo type. can it be done, if so how?
in the code snippet below, if the key == "somevalue", i want to create a row where the datarow[1] will be of combo type. can it be done?
private void UpdateDataTable(string key, object value) {
if(dt.Rows.Contains(key))
{
Debug.WriteLine("found row");
DataRow myrow = dt.Rows.Find( key);
myrow["Values"]= value;
}
else
{
dt.LoadDataRow(new object[] { key, value }, true);
}
dt.AcceptChanges();
}
Yes you can do it. I believe you have to tinker with DataGridViewCell.EditType.
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcell.edittype.aspx
精彩评论