or
Private Sub rgvSrcExtractFiles_RowValidating(ByVal sender As System.Object, ByVal e As Telerik.WinControls.UI.RowValidatingEventArgs) Handles rgvSrcExtractFiles.RowValidating If TypeOf e.Row Is GridViewDataRowInfo Then For Each cell As GridViewCellInfo In e.Row.Cells Select Case cell.ColumnInfo.Name Case "FileDirectory" If Not FileAcc.DirectoryExists(cell.Value) Then cell.ErrorText = "Directory not found!" ElseIf FileAcc.CountFilePrefixWithExt(cell.Value, e.Row.Cells("FilePrefix").Value, e.Row.Cells("FileExtension").Value) = 0 Then cell.ErrorText = "No valid files found in directory!" Else cell.ErrorText = String.Empty End If Case "FilePrefix" If FileAcc.CountFilePrefix(e.Row.Cells("FileDirectory").Value, cell.Value) = 0 Then cell.ErrorText = "Files not found!" Else cell.ErrorText = String.Empty End If Case "FileExtension" If FileAcc.CountFileExt(e.Row.Cells("FileDirectory").Value, cell.Value) = 0 Then cell.ErrorText = "Files not found!" Else cell.ErrorText = String.Empty End If End Select Next End IfEnd SubPrivate Sub rgvSrcExtractFiles_CellValidating(ByVal sender As System.Object, ByVal e As Telerik.WinControls.UI.CellValidatingEventArgs) Handles rgvSrcExtractFiles.CellValidating Dim column As GridViewDataColumn = TryCast(e.Column, GridViewDataColumn) If TypeOf e.Row Is GridViewDataRowInfo AndAlso column IsNot Nothing Then Select Case column.Name Case "FileDirectory" If Not FileAcc.DirectoryExists(e.Value) Then DirectCast(e.Row.Cells(e.ColumnIndex), GridViewCellInfo).ErrorText = "Directory not found!" ElseIf FileAcc.CountFilePrefixWithExt(e.Value, e.Row.Cells("FilePrefix").Value, e.Row.Cells("FileExtension").Value) = 0 Then DirectCast(e.Row.Cells(e.ColumnIndex), GridViewCellInfo).ErrorText = "Files not found!" Else DirectCast(e.Row.Cells(e.ColumnIndex), GridViewCellInfo).ErrorText = String.Empty End If Case "FilePrefix" If FileAcc.CountFilePrefix(e.Row.Cells("FileDirectory").Value, e.Value) = 0 Then DirectCast(e.Row.Cells(e.ColumnIndex), GridViewCellInfo).ErrorText = "Files not found!" Else DirectCast(e.Row.Cells(e.ColumnIndex), GridViewCellInfo).ErrorText = String.Empty End If Case "FileExtension" If FileAcc.CountFileExt(e.Row.Cells("FileDirectory").Value, e.Value) = 0 Then DirectCast(e.Row.Cells(e.ColumnIndex), GridViewCellInfo).ErrorText = "Files not found!" Else DirectCast(e.Row.Cells(e.ColumnIndex), GridViewCellInfo).ErrorText = String.Empty End If End Select End IfEnd SubPrivate Sub rgvSrcExtractFiles_CellFormatting(ByVal sender As System.Object, ByVal e As Telerik.WinControls.UI.CellFormattingEventArgs) Handles rgvSrcExtractFiles.CellFormatting Dim cell As GridDataCellElement = TryCast(e.CellElement, GridDataCellElement) If cell IsNot Nothing Then If cell.ContainsErrors Then 'Uncomment to draw a red border around cell as well 'cell.DrawBorder = True 'cell.BorderBoxStyle = BorderBoxStyle.SingleBorder 'cell.BorderWidth = 2 'cell.BorderColor = Color.Red 'cell.ImageAlignment = ContentAlignment.MiddleRight Dim prov As New ErrorProvider Dim conv As New ImageConverter cell.Image = conv.ConvertFrom(prov.Icon) cell.TextImageRelation = TextImageRelation.TextBeforeImage cell.ImageAlignment = ContentAlignment.MiddleRight cell.ImageLayout = ImageLayout.None Else 'Resets the borders to the original value 'cell.ResetValue(LightVisualElement.DrawBorderProperty, ValueResetFlags.Local) 'cell.ResetValue(LightVisualElement.BorderBoxStyleProperty, ValueResetFlags.Local) 'cell.ResetValue(LightVisualElement.BorderWidthProperty, ValueResetFlags.Local) 'cell.ResetValue(LightVisualElement.BorderColorProperty, ValueResetFlags.Local) cell.Image = Nothing End If End IfEnd Sub



