开发者

change a particular cell in datagridview to be of type combo

开发者 https://www.devze.com 2023-01-20 04:40 出处:网络
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?

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

精彩评论

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

关注公众号