
Untitled
By: a guest on
Apr 29th, 2012 | syntax:
None | size: 1.08 KB | hits: 13 | expires: Never
C#: DataGridViewCheckBoxCell strange behaviour
foreach (string pre in preselect)
{
foreach (DataGridViewRow row in dgvProtFunc.Rows)
{
if ((string)row.Cells[2].Value == pre)
{
((DataGridViewCheckBoxCell)row.Cells[0]).Value = true;
}
}
}
private void dgvProtFunc_CurrentCellDirtyStateChanged(object sender, EventArgs e)
{
if (dgvProtFunc.IsCurrentCellDirty)
{
dgvProtFunc.CommitEdit(DataGridViewDataErrorContexts.Commit);
}
}
private void dgvProtFunc_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
if (!FormLoadCheck)
{
string data = string.Empty;
ptSelectList.Clear();
foreach (DataGridViewRow row in dgvProtFunc.Rows)
{
if (row.Cells[0].Value != null && Convert.ToBoolean(row.Cells[0].Value) == true)
{
ptSelectList.Add(Convert.ToInt32(row.Cells[1].Value));
}
data += row.Cells[0].Value;
}
ptSelectList.Sort();
FilterRelais(ptSelectList.ToArray());
MessageBox.Show(data);
}
}