开发者

change a particular cell in datagridview to be of type combo

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜