Hello,
I have a GridControl with 3 columns. Cells in column C contains a conditional formula that return only two values: 0 or 1. I want that the format of column B changes depending on the value of column C.
This it is the algorithm:
If C1=1 then B1.ReadOnly=True : B1.BackColor=Gray ....
Else B1.ReadOnly=False : B1.BackColor=White ....
If C2=1 then B2.ReadOnly=True : B2.BackColor=Gray ....
Else B2.ReadOnly=False : B2.BackColor=White ....
If C3=1 then B3.ReadOnly=True : B3.BackColor=Gray ....
Else B3.ReadOnly=False : B3.BackColor=White ....
Something like this already I try:
Private Sub GridControl1_CurrentCellDeactivated(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridCurrentCellDeactivatedEventArgs) Handles GridControl1.CurrentCellDeactivated
If e.ColIndex = 2 Then
For i = 1 To GridControl1.RowCount
If GridControl1(i, 3).FormattedText = "1" Then
GridControl1(i, 2).ReadOnly = False
GridControl1(i, 2).BackColor = Color.Gray
GridControl1(i, 2).Text = "NA"
GridControl1(i, 2).ReadOnly = True
Else
GridControl1(i, 2).ReadOnly = False
GridControl1(i, 2).BackColor = Color.White
If GridControl1(i, 2).Text = "NA" Then
GridControl1(i, 2).Text = ""
End If
End If
Next
End If
End Sub
But it does not work well.
I saw that in your Web page you have a sample named "Formatting Cells Based on Criteria", I think that is seemed to that I need, but I not where to find it.
Best Regards,
Jorge
P.D. I do not speak very well English, it excuses if I am mistaken.
ConditionalFormattingSample.zip