Back to Devexpress

VGridControlBase.RowChanging Event

windowsforms-devexpress-dot-xtraverticalgrid-dot-vgridcontrolbase-28a7bbd8.md

latest4.4 KB
Original Source

VGridControlBase.RowChanging Event

Fires when changing a row’s property.

Namespace : DevExpress.XtraVerticalGrid

Assembly : DevExpress.XtraVerticalGrid.v25.2.dll

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

Declaration

csharp
public event RowChangingEventHandler RowChanging
vb
Public Event RowChanging As RowChangingEventHandler

Event Data

The RowChanging event's data class is RowChangingEventArgs. The following properties provide information specific to this event:

PropertyDescription
CanChangeGets or sets a value specifying whether the row can be changed.
ChangeTypeGets the way in which the row has changed. Inherited from RowChangedEventArgs.
PropertiesGets the processed row’s properties. Inherited from RowChangedEventArgs.
PropertyValueGets or sets the current value of the changed row property.
RowGets the processed row. Inherited from RowEventArgs.

Remarks

This example handles the vertical grid’s RowChanging event to prevent users from changing the row height. The example handles the RowChanged event to log row changes (user actions).

csharp
using DevExpress.XtraEditors;
using DevExpress.XtraVerticalGrid;
using DevExpress.XtraVerticalGrid.Events;

namespace DXApplication28 {
    public partial class Form1 : XtraForm {
        public Form1() {
            InitializeComponent();
            vGridControl1.RowChanging += VGridControl1_RowChanging;
            vGridControl1.RowChanged += VGridControl1_RowChanged;
        }

        void VGridControl1_RowChanged(object sender, RowChangedEventArgs e) {
            listBoxControl1.Items.Add(string.Format("Change type: {0}", e.ChangeType));
        }

        void VGridControl1_RowChanging(object sender, RowChangingEventArgs e) {
            e.CanChange = e.ChangeType != RowChangeTypeEnum.Height;
        }
    }
}
vb
Imports DevExpress.XtraEditors
Imports DevExpress.XtraVerticalGrid
Imports DevExpress.XtraVerticalGrid.Events

Namespace DXApplication28
    Partial Public Class Form1
        Inherits XtraForm

        Public Sub New()
            InitializeComponent()
            AddHandler vGridControl1.RowChanging, AddressOf VGridControl1_RowChanging
            AddHandler vGridControl1.RowChanged, AddressOf VGridControl1_RowChanged
        End Sub

        Private Sub VGridControl1_RowChanged(ByVal sender As Object, ByVal e As RowChangedEventArgs)
            listBoxControl1.Items.Add(String.Format("Change type: {0}", e.ChangeType))
        End Sub

        Private Sub VGridControl1_RowChanging(ByVal sender As Object, ByVal e As RowChangingEventArgs)
            e.CanChange = e.ChangeType <> RowChangeTypeEnum.Height
        End Sub
    End Class
End Namespace

See Also

RowChanged

VGridControlBase Class

VGridControlBase Members

DevExpress.XtraVerticalGrid Namespace