property Editor.EditType as EditTypeEnum
Specifies the type of the column's editor.

 TypeDescription 
   EditTypeEnum An EditTypeEnum expression that specifies the type of the editor.  

Use the EditType property to set the type of the editor. By default, the editor's type is ReadOnly. If the control is bound to an ADO recordset the control looks for appropriate editor for each field. Each column has its own editor, that means that all cells of the column will use the column's editor when users edits a cell. The editor is visible only if the CellEditorVisible property is True.  If the EditType is UserEditorType the UserEditor property should be called to initialize the user editor based on the ActiveX's identifier. Use the CellEditor property to specify a particular editor for a specific cell. Use the Option property to define options for a specific type of editor. Use the DefaultEditorOption property to specify default option for the editors of a specified type. Use the Locked property to lock an editor.

The following VB sample sets the column's editor to CheckListType:

Set c = .Columns.Add("Description")
With c.Editor
    .EditType = CheckListType
    .AddItem &H1000, "adFldCacheDeferred", 3
    .AddItem &H10, "adFldFixed", 3
    .AddItem &H40000, "adFldIsCollection", 3
    .AddItem &H20000, "adFldIsDefaultStream", 3
    .AddItem &H20, "adFldIsNullable", 3
    .AddItem &H10000, "adFldIsRowURL", 3
    .AddItem &H80, "adFldLong", 3
    .AddItem &H40, "adFldMayBeNull", 3
    .AddItem &H2, "adFldMayDefer", 3
    .AddItem &H4000, "adFldNegativeScale", 3
    .AddItem &H100, "adFldRowID", 3
    .AddItem &H200, "adFldRowVersion", 3
    .AddItem &H8, "adFldUnknownUpdatable", 3
    .AddItem &H4, "adFldUpdatable", 3
End With

In this case, the value of CellValue property for any cell in "Description" column  should be an OR combination of values added using AddItem, InsertItem methods.

The following VB sample adds an EditType editor to the first visible item:

With Grid1.Items
    With .CellEditor(.FirstVisibleItem, 0)
        .EditType = EXGRIDLibCtl.EditType
    End With
End With

The following C++ sample adds an EditType editor to the first visible item:

#include "Items.h"
#include "Editor.h"
COleVariant vtMissing; V_VT( &vtMissing) = VT_ERROR;
CItems items = m_grid.GetItems();
CEditor editor = items.GetCellEditor( COleVariant( items.GetFirstVisibleItem() ), COleVariant( long(0) ) );
editor.SetEditType( 1 /*EditType*/ );

The following VB.NET sample adds an EditType editor to the first visible item:

With AxGrid1.Items
    With .CellEditor(.FirstVisibleItem, 0)
        .EditType = EXGRIDLib.EditTypeEnum.EditType
    End With
End With

The following C# sample adds an EditType editor to the first visible item:

EXGRIDLib.Items items = axGrid1.Items;
EXGRIDLib.Editor editor = items.get_CellEditor(items.FirstVisibleItem, 0);
editor.EditType = EXGRIDLib.EditTypeEnum.EditType ;

The following VFP sample adds an EditType editor to the first visible item:

with thisform.Grid1.Items
	With .CellEditor(.FirstVisibleItem, 0) 
		.EditType = 1 && EdiType
	EndWith
endwith

 


Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.