winforms - How to create radiobuttons programatically on a datagridview -
i'm using c# in visual studio 2010. have datagridview on winform. 1 column contain radio buttons only. each row have 3 radio buttons. i'm not sure understand needed that. appreciated.
create datagridviewcheckboxcolumn
, connect cellcontentclick
event. use code:
private void datagridview1_cellcontentclick(object sender, datagridviewcelleventargs e) { if (e.columnindex == 0)// checkbox column { object curr = datagridview1[e.columnindex, e.rowindex].value; if (curr == null || (bool)(curr) == false) { (int = 0; < datagridview1.rowcount; i++) { if (i != e.rowindex) { datagridview1[e.columnindex, i].value = false; } } } } }
Comments
Post a Comment