Back to Devexpress

ValidateRowEventArgs.Valid Property

windowsforms-devexpress-dot-xtragrid-dot-views-dot-base-dot-validateroweventargs-f27f72c6.md

latest3.4 KB
Original Source

ValidateRowEventArgs.Valid Property

Gets or sets whether the row validation succeeds.

Namespace : DevExpress.XtraGrid.Views.Base

Assembly : DevExpress.XtraGrid.v25.2.dll

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

Declaration

csharp
public bool Valid { get; set; }
vb
Public Property Valid As Boolean

Property Value

TypeDescription
Boolean

true to accept row cell values; otherwise, false.

|

Remarks

If the row contains values that do not meet your criteria, set the Valid property to false. In this case, the View will display an error message box. The message box enables end-users to keep focus within the row so that its values can be corrected. Another option available is to allow the focus to switch to a different row thus discarding changes made to row cells.

Note that setting the Valid property to false raises the ColumnView.InvalidRowException event. The event can be handled to override the behavior described above.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Valid property.

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-validate-rows-idxdataerrorinfo/CS/WindowsApplication1/Form1.cs#L54

csharp
(e.Row as MyRecord).GetError(info);
    e.Valid = info.ErrorText == "";
}

winforms-grid-validate-rows-idxdataerrorinfo/VB/WindowsApplication1/Form1.vb#L43

vb
TryCast(e.Row, MyRecord).GetError(info)
    e.Valid = Equals(info.ErrorText, "")
End Sub

See Also

InvalidRowException

ValidateRow

Edit Data. Create Cell Editors. Validate User Input

ValidateRowEventArgs Class

ValidateRowEventArgs Members

DevExpress.XtraGrid.Views.Base Namespace