I'm following the example of "https://docs.telerik.com/devtools/winforms/controls/gridview/editors/data-validation" to do some data validation and I'm expecting it to show an error message when the user inputs a non-validated string in the cell, like it's shown in the telerik docs, however even though I can see with the debugger that the .ErrorText property is set, a message is not shown (but e.Cancel works and the focus remains on the problematic cell)
I could call a msgbox() to show the message, but I feel that negates the purpose of setting the .ErrorText property. What am I doing wrong?
Information on the Code block:
AbsenceString = "U". SicknessString = "K". gvTimesheet's ShowCellErrors is set to TRUE on the Designer.
Private Sub gvTimesheet_CellValidating(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.CellValidatingEventArgs) Handles gvTimesheet.CellValidating If e IsNot Nothing AndAlso e.Value IsNot Nothing Then Dim column As GridViewDataColumn = TryCast(e.Column, GridViewDataColumn) If TypeOf e.Row Is GridViewDataRowInfo AndAlso column IsNot Nothing AndAlso column.Index >= 5 Then Dim AbsenceOrIllnessMatch As Match = Regex.Match(DirectCast(e.Value, String), "[" & AbsenceString.ToLower & AbsenceString.ToUpper & SicknessString.ToLower & SicknessString.ToUpper & "]{1}\d+") If DirectCast(e.Value, String) <> "" AndAlso Not IsNumeric(DirectCast(e.Value, String)) AndAlso Not AbsenceOrIllnessMatch.Success Then e.Cancel = True DirectCast(e.Row, GridViewDataRowInfo).ErrorText = sa("The hours-worked values can only be numeric, with optional letters {0} or {1} preceding the numeric part to indicate absence hours or illness hours respectively.", AbsenceString, SicknessString) Else DirectCast(e.Row, GridViewDataRowInfo).ErrorText = String.Empty End If End If End IfEnd Sub
