Hi
Something like this... I have 2 command buttons on a form (command1.. command2) and 2 flexgrids (msflexgrid1 and msflexgrid2)
VB Code:
Private Sub Command1_Click()
Populate MSFlexGrid1
End Sub
Private Sub Command2_Click()
Populate MSFlexGrid2
End Sub
Private Sub Populate(MyGrid As MSFlexGrid)
With MyGrid
.AddItem "blah"
.AddItem "blah"
End With
End Sub
Also, if all the grids are in a control array (ie same name, different indexes) u only need to pass the index number if the populate sub is in the same form...eg
VB Code:
Private Sub Command1_Click()
Populate 1
End Sub
Private Sub Command2_Click()
Populate 2
End Sub
Private Sub Populate(GridNum as Integer)
With MyGrid(GridNum)
.AddItem "blah"
.AddItem "blah"
End With
End Sub
Regards
Stuart