Search code examples
vb.netdevexpressdevexpress-windows-ui

How to Display Error icon in all the cell in devExpress Grid in windows form in vb.net..?


enter image description here

I want to draw error icon in all the cell which are validated at a time in datageid in devExpres.

I was draw a error icon in cell but there is some problem, 1.Color of the cell is overwritted on the error icon. 2.Text of grid and error icon both are mixed that why text is not display excat.

I want perfect example. Is any one have solution?


Solution

  • This can be achieved using the CustomDrawEventHandler as shown below

    Private Sub CustomDrawEventHandler(. ByVal .. As )
    
            If IsError(...) Then
    
                e.EditViewInfo.ErrorIconText = "IsNull"
    
                e.EditViewInfo.ShowErrorIcon = True
    
                e.EditViewInfo.FillBackground = True
    
                e.EditViewInfo.ErrorIcon = DXErrorProvider.GetErrorIconInternal(ErrorType.Critical)
    
                e.EditViewInfo.CalcViewInfo(e.Graphics)
    
            End If
    
    End Sub
    

    For more info check this DevExpress Kb article: http://www.devexpress.com/Support/Center/Example/Details/E1933