I want to validate editing cell, if the cell value is empty or null. I want to show error message to user something like "Field cannot be empty"
Please find attached image
Hi Vijay,
You can use the WinGrid's extended IDataErrorInfo features in order to display this error to users. Please read this topic for an example of how to use IDataErrorInfo with the WinGrid.
I am still getting some problem when I tried to enter some value, so the validation error is not gone away. It's still showing up. I want the validation to be shown only when the cell is null or empty. In which event shall I use this code. But currently I'm using in IntializeRow. I want to enter some value in cell and validation should be cleared off. else if it is empty it should show up validation
Please find attached picture
My code in constructor
Me.ugMain.DisplayLayout.Override.SupportDataErrorInfo = SupportDataErrorInfo.RowsAndCells
My Intialize row
Private Sub ugMain_InitializeRow(sender As Object, e As InitializeRowEventArgs) Handles ugMain.InitializeRow Select laborManagementMaintenanceType Case "Manage Equipment" If e.Row.Cells("Title").Value Is DBNull.Value Then e.Row.DataErrorInfo.SetColumnError("Title", "Cell Error: Zero is invalid.") Else e.Row.DataErrorInfo.ResetRowError() End If
End Select End Sub
Thanks Mike. That's Awesome!