• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 7125
  • Last Modified:

Add data to msFlexGrid

I want to populate a msflexgrid in vb6.0 at runtime. Can someone please show me
First how to add a msflexgrid to a form
them to populate the columns of this grid from textbox or values from memory..

Thank you,
0
Aiysha
Asked:
Aiysha
  • 3
1 Solution
 
samstarkeyCommented:
You need to add a Flexgrid control to a form..  For this instance name it FG

With FG
    .Cols = 4
    .Rows = 1
    .TextMatrix(0, 0) = "Qty"
    .TextMatrix(0, 1) = "Product Code"
    .TextMatrix(0, 2) = "Description"
    .TextMatrix(0, 3) = "Location"
    .ColWidth(0) = 400
    .ColWidth(1) = 1250
    .ColWidth(2) = 2175
    .ColWidth(3) = 1000
End With

This will set up a flexGris with 1 Row and 4 colums.  It will add data to the colum headings.

Now add a command button

' add some data
For x = 0 To 3
   With FG
    .AddItem "" ' Add a blank row
    .TextMatrix(x + 1, 0) = x
    .TextMatrix(x + 1, 1) = "1243132"
    .TextMatrix(x + 1, 2) = "This is test line" & x + 1
    .TextMatrix(x + 1, 3) = "Here"
   End With
Next x

Now add another command button to change a cell colour

Private Sub Command2_Click()
With FG
    .Row = 1
    .Col = 2
    .CellBackColor = &HFF
End With
End Sub

This should get you started





   
0
 
samstarkeyCommented:
Sorry,  Ad the first part to you form load procedure
0
 
samstarkeyCommented:
To add the control at runtime, see

http://support.microsoft.com/kb/q190670/
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now