Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mshflexgrid, Problem with first row

Status
Not open for further replies.

hansu

Programmer
Mar 12, 2002
89
I have a MSHFlexgrid (flgRooms) that has the datasource set to a hierarchical recordset (rstRooms). It is used to show data to the user depending on a date he chooses from a datalist. Whenever the Mshflexgrid is filled the first time the first row does not show. It seems that it uses the fixed row. When the programm is run again the flexgrid shows the data correctly.
I use the following code to populate the grid:
Code:
With flgRooms
    Set rstRooms.DataSource = rstRooms
    If rstRooms.RecordCount > 0 Then
        .BandDisplay = flexBandDisplayHorizontal
        .FixedRows = 1
        .TextMatrix(0, 3) = "Nr."
        .TextMatrix(0, 4) = "Bezeichnung"
        .TextMatrix(0, 5) = "Plätze"
        .TextMatrix(0, 6) = "Belegt"
        .TextMatrix(0, 7) = "Frei"
        .ColHeaderCaption(1, 2) = "Gruppe"
        .ColHeaderCaption(1, 3) = "Plätze von"
        .ColHeaderCaption(1, 4) = "bis"
        .CollapseAll (0)
        .ColWidth(0, 0) = 300
        .ColWidth(1, 0) = 0
        .ColWidth(2, 0) = 0
        .ColWidth(3, 0) = 400
        .ColWidth(4, 0) = 1500
        .ColWidth(5, 0) = 600
        .ColWidth(6, 0) = 600
        .ColWidth(7, 0) = 600
        .ColWidth(0, 1) = 0
        .ColWidth(1, 1) = 0
        .ColWidth(1, 2) = 1500
        .ColWidth(1, 3) = 600
        .ColWidth(1, 4) = 600
        .Width = 7200
        .ScrollBars = flexScrollBarVertical
        .MergeCells = flexMergeFree
    Else
        .Clear
        .FixedRows = 0
    End If
End With
Thanks for your assistance.
 
I believe you need to set your fixed rows property before setting the dataSource property

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Thanks johnwm. To check that I set the fixed rows property in the form load event. But that way the grid never shows the first row. Any other ideas?
 
Set it in the properties window. I've found problems with setting control properties in the Form Load event, since you're not guaranteed that the controls are loaded when you try and set the property. You can usually resolve that if you do a Me.Show and then set your control properties at the end of the Form Load event

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
I set fixedrows now in the properties window. That works fine as long as the recordset returns records. When rerunning the program after an empty recordset the first row is missing again.
 
Could solve the problem now. Had to set the datasource in the if statement of the above code.
Thanks for your help johnwm.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top