Search code examples
vb6farpoint-spread

how to make specific columns editable in vb6


I have this event when you click on a cell, it checks which column (enum) it has been clicked, and then it enables editing if the columns should be editable.

The following columns should be editable and are working ok, but on the else statement I would like that these columns are not editable.

I'm using the highlighted one (Farpoint Spread 6.0 (OLEDB), I'm manually loading it

This is the code I have and it's not disabling the editing for me. any ideas?

Select Case Col
        
        Case gcQtyDelivered, gcQtyFOC, gcQtyDelivered, gcCostPrice, gcRetailprice
            With lstTheLines
                .Row = Row
                .UserResizeCol = UserResizeOn
                .EditMode = True
                .Protect = False
            End With
        Case Else
            With lstTheLines
                .Row = Row
                '.Locked = True
                '.ReadOnly = True
                '.Enabled = False ' locks the full grid
                '.EditMode = False
                '.EditMode = False
                '.Col.ReadOnly = True
                .Enabled = True
                .Locked = False
                
            End With
            
End Select

Solution

  • Here's a block of code I use to Lock an entire column:

    Sheet.BlockMode = True
    Sheet.Row = 0
    Sheet.Row2 = Sheet.MaxRows
    Sheet.Col = 1
    Sheet.Col2 = 1
    Sheet.Lock = True
    Sheet.BlockMode = False
    

    You specify the column by setting the Row and Col properties. In this example, I am locking column 1 for all rows. Adjust these properties to suit your needs.