private void MyTable_CurrentCellDirtyStateChanged(object sender, EventArgs e) { if (Convert.ToInt16(MyTable.SelectedCells[0].ColumnIndex) != 0) { return; } k = 0; MyTable.EndEdit(); if (k == 1) { return; } else { k++; v = Convert.ToDouble(LimitMemory.Text); int index = MyTable.SelectedCells[0].RowIndex; if (Convert.ToBoolean(MyTable.CurrentCell.Value) == true) { resultV += 1.5 * Convert.ToInt16(MyTable.Rows[index].Cells[4].Value) * ToDefineType(lstWithTypeIter[index]); MyTable.Rows[index].Cells[6].Value = 1.5 * Convert.ToInt16(MyTable.Rows[index].Cells[4].Value) * ToDefineType(lstWithTypeIter[index]); myWin += Convert.ToInt16(MyTable.Rows[index].Cells[4].Value) * ToCalculateDifference(lstWithTypeIter[index]); if (resultV <= v) { labelAWithWin.Text = ""; labelAWithWin.Text = "F = " + myWin + " затрачено " + resultV + " байт"; } else { labelAWithWin.Text = ""; labelAWithWin.Text = "Ограничение не выполняется, " + " затрачено: " + resultV + " байт"; } return; } else { resultV -= 1.5 * Convert.ToInt32(MyTable.Rows[index].Cells[4].Value) * ToDefineType(lstWithTypeIter[index]); myWin -= Convert.ToInt32(MyTable.Rows[index].Cells[4].Value) * ToCalculateDifference(lstWithTypeIter[index]); MyTable.Rows[index].Cells[6].Value = 0; if (resultV <= v) { labelAWithWin.Text = ""; labelAWithWin.Text = "F = " + myWin + " затрачено " + resultV + " байт"; } else { labelAWithWin.Text = ""; labelAWithWin.Text = "Ограничение не выполняется, " + " затрачено: " + resultV + " байт"; } return; } } }