DataGridView checkbox column - value and functionality

后端 未结 11 1734
一向
一向 2020-11-28 12:17

I\'ve added a checkbox column to a DataGridView in my C# form. The function needs to be dynamic - you select a customer and that brings up all of their items that could be s

11条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-28 12:52

    It is quite simple

    DataGridViewCheckBoxCell checkedCell = (DataGridViewCheckBoxCell) grdData.Rows[e.RowIndex].Cells["grdChkEnable"];
        
    bool isEnabled = false;
    if (checkedCell.AccessibilityObject.State.HasFlag(AccessibleStates.Checked))
    {
        isEnabled = true;
    }
    if (isEnabled)
    {
       // do your business process;
    }
    

提交回复
热议问题