windowsforms-devexpress-dot-xtraverticalgrid-dot-vgridcontrolbase-3ead1b7c.md
Invokes the focused cell’s editor.
Namespace : DevExpress.XtraVerticalGrid
Assembly : DevExpress.XtraVerticalGrid.v25.2.dll
NuGet Packages : DevExpress.Win.Navigation, DevExpress.Win.VerticalGrid
public virtual void ShowEditor()
Public Overridable Sub ShowEditor
The ShowEditor method is automatically called when end-users invoke a cell editor. You can also call this method manually. Note that if you want to activate a particular cell’s editor, you need to focus the cell first. Use the VGridControlBase.FocusedRow and VGridControlBase.FocusedRecord properties for this purpose.
A cell editor cannot be activated if the VGridControlBase.CanShowEditor property returns false (the user cannot edit the focused cell’s value).
For more information, see Showing and Hiding Editors.
The following sample code assumes that a grid control has the row_Price editor row containing information about car prices. The code invokes the Price field editor of the first record when the form is loaded. When the editor is closed (here the code handles the VGridControlBase.HiddenEditor event), the next record is focused and the editor for the Price field is again invoked, etc.
private void Form1_Load(object sender, System.EventArgs e) {
// some code concerning binding grid to data
/....
// invoking editor for the first data cell of the Price row
vGridControl1.FocusedRecord = 0;
vGridControl1.FocusedRow = vGridControl1.Rows["row_Price"];
vGridControl1.ShowEditor();
}
private void vGridControl1_HiddenEditor(object sender, System.EventArgs e) {
VGridControl vGrid = sender as VGridControl;
// checking whether the Price row is focused
if (vGrid.FocusedRow != vGrid.Rows["row_Price"]) return;
if (vGrid.FocusedRecord == vGrid.RecordCount - 1)
vGrid.FocusedRecord = 0;
else
vGrid.FocusedRecord++;
// invoking editor for the currently focused data cell
vGrid.ShowEditor();
}
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
' some code concerning binding grid to data
'....
' invoking editor for the first data cell of the Price row
VGridControl1.FocusedRecord = 0
VGridControl1.FocusedRow = VGridControl1.Rows("row_Price")
VGridControl1.ShowEditor()
End Sub
Private Sub VGridControl1_HiddenEditor(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles VGridControl1.HiddenEditor
Dim VGrid As VGridControl = CType(sender, VGridControl)
' checking whether the Price row is focused
If Not VGrid.FocusedRow Is VGrid.Rows("row_Price") Then Return
If VGrid.FocusedRecord = VGrid.RecordCount - 1 Then
VGrid.FocusedRecord = 0
Else
VGrid.FocusedRecord = VGrid.FocusedRecord + 1
End If
' invoking editor for the currently focused data cell
VGrid.ShowEditor()
End Sub
See Also