Back to Devexpress

GridControl.NewItemRowHandle Field

windowsforms-devexpress-dot-xtragrid-dot-gridcontrol-69bbf0e9.md

latest5.3 KB
Original Source

GridControl.NewItemRowHandle Field

Contains a value which represents the handle of the New Item Row/Card. For more information on row handles refer to the Rows section.

Namespace : DevExpress.XtraGrid

Assembly : DevExpress.XtraGrid.v25.2.dll

NuGet Packages : DevExpress.Win.Grid, DevExpress.Win.Navigation

Declaration

csharp
public const int NewItemRowHandle = -2147483647
vb
Public Const NewItemRowHandle As Integer = -2147483647

Field Value

Type
Int32

The following code snippets (auto-collected from DevExpress Examples) contain references to the NewItemRowHandle field.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-grid-prevent-focusing-group-row/CS/Form1.cs#L28

csharp
int focusedRowHandle = -1;
if (e.FocusedRowHandle == GridControl.NewItemRowHandle || e.FocusedRowHandle == GridControl.AutoFilterRowHandle)
    return;

winforms-grid-display-icons-in-data-cells/CS/Form1.cs#L243

csharp
private void GridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) {
    if (e.RowHandle != GridControl.NewItemRowHandle && e.Column.FieldName == "CustomDraw") {
        e.DisplayText = string.Empty;

winforms-grid-add-new-row-by-typing-in-new-item-row/CS/WindowsApplication3/Main.cs#L35

csharp
{
    if(gridView.FocusedRowHandle == GridControl.NewItemRowHandle)
    {

winforms-grid-crud-operations-odata/CS/DxSample/MainForm.cs#L24

csharp
private void GridView_RowUpdated(object sender, RowObjectEventArgs e) {
    if (e.RowHandle == GridControl.NewItemRowHandle)
        this.Context.AddToOrders((Order)e.Row);

winforms-grid-prevent-focusing-group-row/VB/Form1.vb#L28

vb
Dim focusedRowHandle As Integer = -1
If e.FocusedRowHandle = GridControl.NewItemRowHandle OrElse e.FocusedRowHandle = GridControl.AutoFilterRowHandle Then Return
Dim view As GridView = CType(sender, GridView)

winforms-grid-display-icons-in-data-cells/VB/Form1.vb#L215

vb
Private Sub GridView1_CustomDrawCell(ByVal sender As Object, ByVal e As Views.Base.RowCellCustomDrawEventArgs)
    If e.RowHandle <> GridControl.NewItemRowHandle AndAlso Equals(e.Column.FieldName, "CustomDraw") Then
        e.DisplayText = String.Empty

winforms-grid-add-new-row-by-typing-in-new-item-row/VB/WindowsApplication3/Main.vb#L30

vb
Private Sub OnEditValueChanged(ByVal sender As Object, ByVal e As EventArgs)
    If gridView.FocusedRowHandle = GridControl.NewItemRowHandle Then
        gridView.CloseEditor()

winforms-grid-crud-operations-odata/VB/DxSample/MainForm.vb#L26

vb
Private Sub GridView_RowUpdated(ByVal sender As Object, ByVal e As RowObjectEventArgs) Handles GridView.RowUpdated
    If e.RowHandle = GridControl.NewItemRowHandle Then
        Me.Context.AddToOrders(DirectCast(e.Row, Order))

See Also

AutoFilterRowHandle

InvalidRowHandle

GridControl Class

GridControl Members

DevExpress.XtraGrid Namespace