c# - DataGridViewCheckBoxColumns of a DataGridView permit multiple Rows checked -
i've datagridview on i've added checkboxcolumn. have datasource, list of object whit set , get; have boolean properties "checked" used checkbox column.. gets data source should boolean states checkboxes in datagridview, when click on checkbox allow 1 checkbox checked @ time. can select multiple rows , set true bounded "checked" properties?
public class mydatasource { public mydatasource (){} public boolean checked { get; set; } public string description { get; set; } }
i've added datasource grid class system.windows.forms.bindingsource
and add cell click event
private void my_grd_cellclick(object sender, datagridviewcelleventargs e) { if (e.rowindex < 0) return; var datagridview = (datagridview)sender; var cell = datagridview[0, e.rowindex]; if (cell.value == null) cell.value = false; cell.value = !(bool)cell.value; }
Comments
Post a Comment