ComponentOne VSFlexGrid 8.0
How can I add or delete a column at a given position?

To add a column at a specific position, create the new column by incrementing the Cols property, then move it to the desired position using the ColPosition property.

To delete a column at a specific position, move the column to the right using the ColPosition property, then delete it by decrementing the Cols property.

The following VB code shows how to do it: it deletes the current column or inserts a new column to the left of the current column, depending on which button was clicked.

Example Title
Copy Code
 Private Sub Command1_Click(Index As Integer)

     With fg   

     ' insert column

     If Index = 0 Then

         .Cols = .Cols + 1               ' add column

         .ColPosition(.Cols - 1) = .Col  ' move into place

           

     ' delete column

     Else

         .ColPosition(.Col) = .Cols - 1  ' move to right

         .Cols = .Cols - 1               ' delete column

        End If

        End With

 End Sub

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback