Posted 20 December 2022, 11:30 am EST
Hi all,
I need to go through the flexgrid and lock all the cell from editiong if it contains an amount/number. I used the bellow code in VB but it does not work and hope you can support.
Best regards
Said
Private Sub CellBlock() Try If IsNothing(Flexgrid.DataSource) Then Exit Sub Else Dim ycount As Int32 = DirectCast(Flexgrid.DataSource, DataTable).Rows.Count If ycount > 0 Then Dim rw As Integer = 0 For Each r As Row In Flexgrid.Rows If rw = 0 Then rw += 1 Else If Flexgrid(rw, 6) Is DBNull.Value Or GetValue(Flexgrid(rw, 6)) = 0 Then Else Flexgrid(rw, 6).allowediting = False End If rw += 1 End If Next End If End If Catch ex As Exception MsgBox("Error 'CellBlock' : " & vbCrLf & ex.ToString, MsgBoxStyle.Critical) End Try End Sub