AddItem Method
Adds a row to the control.
Syntax
[form!]VSFlexGrid.AddItem Item As String, [ Row As Long ]
Remarks
The parameters for the AddItem method are described below:
Item As String
String expression to add to the control. The string contains entries for each column on the new row, separated by tabs (vbTab or Chr(9)). You may change the column separator character by assigning a new value to the ClipSeparators property.
Row As Long (optional)
Zero-based index representing the position within the control where the new row is placed. If Row is omitted, the new row is added at the bottom of the grid.
For example:
fg.FormatString = "=Rec#|Name |Phone|Hired"
fg.Cols = 4
fg.Rows = 1
fg.AddItem fg.Rows & vbTab & "Paul" & vbTab & "555-1212" & vbTab & "12/10/1997"
fg.AddItem fg.Rows & vbTab & "John" & vbTab & "555-1313" & vbTab & "12/10/1997", 1
This code adds a row, then inserts another one above the first.
To remove rows, use the RemoveItem method. Alternatively, you may add or remove rows at the bottom of the grid by setting the Rows property.