|
-
Sep 30th, 2005, 09:51 PM
#1
Thread Starter
Member
[RESOLVED] MSFlexgrid Refresh (?) or Redraw (?)
Hi,
I have an MSFlexgrid grid displayed initially sorted by student ID. In the display, I have a sort command button for LastName sorting. The problem is i can't refresh the display after clicking the sort button.
Thanking you in advance.
Here's my code:
VB Code:
-----------------------------------------------------------
Private Sub cmdSort_Click()
varSortBy = "LastName" ' varSortBy is global var
Call Form_Load
End Sub
-----------------------------------------------------------
Private Sub Form_Load()
If varSortBy = "" Then
'Initial Form Load
varSortBy = "s_id"
MSFlexGrid2.FormatString = "Test"
Data2.DatabaseName = App.Path & "\Student.mdb"
Data2.RecordSource = "Select * FROM Projects ORDER BY " & varSortBy
Else
'Called from sort button
varSortBy = varSortBy
MSFlexGrid2.FormatString = "Test"
Data2.DatabaseName = App.Path & "\Student.mdb"
Data2.RecordSource = "select * FROM Projects ORDER BY " & varSortBy
MSFlexGrid2.Refresh
End If
End Sub
-
Sep 30th, 2005, 10:01 PM
#2
Re: MSFlexgrid Refresh (?) or Redraw (?)
Bound controls are evil, and hard to use. I always load the flexgrid myself. If I requery, I just clear the grid and call the reload method again. It may be a little bit slower, but I have full control over the formatting, color, and alignment of each cell in the grid.
-
Oct 1st, 2005, 11:04 AM
#3
Re: MSFlexgrid Refresh (?) or Redraw (?)
Call the Refresh method of the Data Control not the FlexGrid or use the Sort method of the FlexGrid and avoid a requery.
-
Oct 1st, 2005, 11:47 AM
#4
Hyperactive Member
Re: MSFlexgrid Refresh (?) or Redraw (?)
There are particular peculiarities of the MSHFlexGrid in terms of changing the underlying recordsource in any way. I wittered on about them a bit in this thread. Basically, using Set MSHFlexGrid.Recordset = ... seems the way to go.
-
Oct 2nd, 2005, 02:28 AM
#5
Thread Starter
Member
Re: MSFlexgrid Refresh (?) or Redraw (?)
Thanks a lot BruceVde. It's working now.
 Originally Posted by brucevde
Call the Refresh method of the Data Control not the FlexGrid or use the Sort method of the FlexGrid and avoid a requery.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|