public override void DetachEditingControl() { DataGridView dataGridView = base.DataGridView; if ((dataGridView == null) || (dataGridView.EditingControl == null)) { throw new InvalidOperationException(); } MaskedTextBox editingControl = dataGridView.EditingControl as MaskedTextBox; if (editingControl != null) { editingControl.ClearUndo(); } base.DetachEditingControl(); }
public override void DetachEditingControl() { DataGridView dataGridView = base.DataGridView; if (dataGridView == null || dataGridView.EditingControl == null) { throw new InvalidOperationException(); } MaskedTextBox maskedTextBox = dataGridView.EditingControl as MaskedTextBox; if (maskedTextBox != null) { maskedTextBox.ClearUndo(); } base.DetachEditingControl(); }
public void UndoTest() { MaskedTextBox mtb; mtb = new MaskedTextBox(); mtb.Text = "abcdef"; Assert.AreEqual(false, mtb.CanUndo, "#A0-c"); mtb.Undo(); Assert.AreEqual("abcdef", mtb.Text, "#A1"); Assert.AreEqual(false, mtb.CanUndo, "#A1-c"); mtb.Text = "cdef"; mtb.ClearUndo(); Assert.AreEqual("cdef", mtb.Text, "#A2"); Assert.AreEqual(false, mtb.CanUndo, "#A2-c"); mtb.Dispose(); }