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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FlexGrid loading problem

Status
Not open for further replies.

srussell705

Programmer
Mar 26, 2001
13
US
For some reason the bound consept of the Flexgrid is not loading data into the grid. I guess I am missing some simple point?

So i am forcing a load manualy. Unfortunatly when the grid is shown, I see a repeat of the last row for every row in my grid.

I have a rs loaded, and it has rs(3) as a max index.

Set rs = cnFleet.Execute(sql)
' Set Me.dgOutstanding.DataSource = rs fails to load?

With dgOutstanding
.FormatString = "^Charge Date|^Charge Amount|^Curr Status|^Charge Created"
.AllowUserResizing = flexResizeColumns
.ColWidth(0) = 1000: 'date for
.ColWidth(1) = 1500: 'amount
.ColWidth(2) = 1000: 'status
.ColWidth(3) = 1000: 'posted date

End With


If rs.EOF = False Then
rs.MoveFirst
Do Until rs.EOF = True
If i > 1 Then
Me.dgOutstanding.Rows = i + 1
'Me.dgOutstanding.RowSel + 1
End If
' Fill the grid col by col
Do Until ii = rs.Fields.count
Me.dgOutstanding.RowSel = i
Me.dgOutstanding.ColSel = ii
' Me.dgOutstanding.FillStyle = flexFillRepeat
Me.dgOutstanding.Text = rs(ii)
' update the col counter
ii = ii + 1
Loop
' reset the col counter
ii = 0
'update the row counter
i = i + 1 ' row
rs.MoveNext
Loop
End If
Set rs = Nothing

'Me.dgOutstanding.Refresh


for some reason I change the display of data if I change the # of fixed cols from 0 to 4. If it's 0 the same last date col is visible for the entire grid in each col? If I put the maxcol to 3 I get changing data. Makes no sense

Anyone see what I am doing wrong?

TIA

__stephen
 
You say this is a flexgrid ? An MSFlexGrid ?

Here's how I load my grid manually:

Code:
Do While Not rsUnmatched.EOF
   flxUnmatched.TextMatrix(r, 0) = Trim(rsUnmatched!classid)
   flxUnmatched.TextMatrix(r, 1) = Trim(rsUnmatched!ClassDesc)
   r = r + 1
   rsUnmatched.MoveNext
Loop

I use the "Textmatrix" property, rather than the "text" property. It accepts two parameters: "ROW", "COLUMN". In this case "ROW" = "r" and each "COLUMN" is hardcoded.

HTH

AMACycle

American Motorcyclist Association
 
sorry, your code whould look like this:

Code:
with dgOutstanding
   Do Until rs.EOF
      If i > 1 Then
         .Rows = i + 1 
      End If
      ' Fill the grid col by col
      Do Until ii = rs.Fields.count
         .TextMatrix(i, ii) = rs(ii)
         ii = ii + 1
      Loop
      ' reset the col counter
      ii = 0
      'update the row counter
      i = i + 1  ' row
      rs.MoveNext
   Loop
End With

HTH



AMACycle

American Motorcyclist Association
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top