flexgrid refresh

TheDutch IceMan
01-14-2004, 03:45 PM
I tried everything, searched the web, this forum but nothing helps.... :confused:

I am trying to refresh a MSHFLEXGRID which is on another form.
When my frmFind is shown (vbModal) it shows records in a MSHFLEXGRID. After clicking one of those, I can hit a button called "Update" and another form is opening with corresponding fields to update the record by means of a stored procedure.

After updating I try to refresh the MSHFLEXGRID but untill now I didn't have any success.

Here's the code:

Opening frmFind and getting the records:


Public Sub setFlexgrid(fg As MSHFlexGrid)
'ged rid of any source
Set fg.DataSource = Nothing
'clear the grid
fg.Clear

fg.Height = Picture1.Height
fg.Top = Picture1.Top
ThinBorder fg.hwnd, True
'format the grid
Call FormatGridBefore(fg)
'the recordset
Set gobjRs = New ADODB.Recordset
'check for empty string (for stored procedure)
If strSP <> "" Then
Call FillRecordSet(strSP, gobjRs, True)
'check if the connection is open
If gobjRs.State = adStateOpen Then
'set datasource
Set fg.DataSource = gobjRs
're-format (for fixed row)
Call FormatGridAfter(fg)
'no records, set the buttons conform
If gobjRs.RecordCount = 0 Then
Me.Command1(0).Enabled = False
Me.Command1(4).Enabled = False
Me.Command1(5).Enabled = False
Me.lstSorteren.Enabled = False
Me.txtZoeken.Enabled = False
End If
'close and clear mem.
gobjRs.Close
Set gobjRs = Nothing
Else
Call FormatGridAfter(fg)
Exit Sub
End If
End If
End Sub




Within frmEditAfdeling


Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Call frmFind.setFlexgrid(frmFind.MSHFlexGrid1)
End Sub


Anybody has an idea of what i am doing wrong?

I've tried the "Thinker" method but without succes
Private Sub ClearFG()
Set MSHFG1.DataSource = Nothing
MSHFG1.Clear
MSHFG1.Rows = 2
MSHFG1.Cols = 1
End Sub


So I must do something wrong........ :confused: :(

Dennis DVR
01-14-2004, 11:44 PM
I think richard there's nothing wrong your code the problem is that your flexgrid is in another form and that form should be reloaded to be able to update its control try to set the autoredraw = true of that form.

chat w/ me later




Dennis :)

TheDutch IceMan
01-15-2004, 02:33 AM
I think richard there's nothing wrong your code the problem is that your flexgrid is in another form and that form should be reloaded to be able to update its control try to set the autoredraw = true of that form.

chat w/ me later




Dennis :)

hehe dennis, Thanks for answering...yeps, I think also there's nothing wrong with the code. It could be the problem that I am loading the first screen vbModal or it lies in the MDI-child/Non-MDI-child. I've been busy with it late yesterday (same as you ;) ) but today I'm fresh and have a look again. :whoops:

cya

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum