public class GameBoardCell : TextBox { public bool IsBlocked; protected SudokuControl _Mother; protected int _Value; public int Value { get { return _Value; } } protected List _PossibleValues; public GameBoardCell(SudokuControl Mother) { _Value = 0; _Mother = Mother; } public void SetPossibleValues(List possibles) { _PossibleValues = possibles; _Value = _PossibleValues[0]; _PossibleValues.RemoveAt(0); this.Text = _Value.ToString(); } public bool StepNextPossibleEntry() { if (IsBlocked == true) return false; if (_PossibleValues.Count > 0) { _Value = _PossibleValues[0]; _PossibleValues.RemoveAt(0); this.Text = _Value.ToString(); return true; } _Value = 0; return false; } protected override void OnTextChanged(EventArgs e) { _Value = Int16.Parse(this.Text); if (_Mother.IsInEditMode == true) IsBlocked = true; base.OnTextChanged(e); } }