Prepares the cell for editing a value.
[Visual Basic] Overrides Public Sub Edit( _ ByVal source As ListManager, _ ByVal rowNum As Integer, _ ByVal bounds As Rectangle, _ ByVal readOnly As Boolean, _ ByVal instantText As String, _ ByVal cellIsVisible As Boolean _ ) [C#] public override void Edit( ListManager source, int rowNum, Rectangle bounds, bool readOnly, string instantText, bool cellIsVisible ); [C++] public: override void Edit( ListManager* source, int rowNum, Rectangle bounds, bool readOnly, String* instantText, bool cellIsVisible ); [JScript] public override function Edit( source : ListManager, rowNum : int, bounds : Rectangle, readOnly : Boolean, instantText : String, cellIsVisible : Boolean );
Unlike the typical implementation of this method (as described in the DataGridColumn class), the Edit method doesn't site a control for editing the column value. Instead a check box is drawn when the Paint method is called.
The following example overrides the base class's Edit method. Two variables are checked to ensure that the column is in an editable state. Then a variable (IsEditing) is set to signal that an edit is occurring. The GetColumnValueAtRow method is called to set a variable to the current value. Finally, the base class's Invalidate method is called to repaint the column.
[Visual Basic]
Overloads Overrides Sub OnEdit( _ ByVal view As Data.System.Data.DataView, _ ByVal rowNum As Long, ByVal bounds As UI.System.Drawing.Rectangle, _ ByVal readOnly As Boolean) isEditing = True editingRow = rowNum currentValue = GetColumnValueAtRow(view, rowNum) MyBase.Invalidate End Function
DataGridBoolColumn Class | DataGridBoolColumn Members | System.WinForms Namespace