Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP 7.0 Crashing Often
Message
From
14/09/2001 12:16:07
 
 
To
11/09/2001 17:33:07
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00550646
Message ID:
00556566
Views:
20
>In thread #544693 New C0000005 error on VFP 7 I explained it.
>This program re-builds a grid by calling constantly grid init() event.
>I posted init event code. A many of people can reproduces this error but Mike Stewart from Microsoft says that he is unable to reproduce this error.
>
I have a similar issue with grids and init's. When you requery a view that's used in the grid, in the grid's INIT(), you also get a C5 error. This is reproducable for me every time (in both VFP6 and VFP7) with the following code:
Just paste the code into a prg and run it. When it comes up, clicking the Rebuild Grid builds a grid, and clicking it again removes it and rebuilds it. But the 2nd time, the view that's displayed in the grid is requeried, and you will get a C5 error. I'm going to report this to Microsoft as a bug. If Mike Stewart (?) would like to take a look at it and reply here, that would be great.

** START CODE **
public junk
Junk = createobject('oJunkForm')
Junk.Name = 'Junk'
=CREATEOBJECT('CmdQuit')
=CREATEOBJECT('CmdRebuildGrid')
=CREATEOBJECT('CmdRequeryView')
Junk.Addobject('CmdQuit', 'CmdQuit')
Junk.AddObject('CmdRebuildGrid','CmdRebuildGrid')
Junk.AddObject('CmdRequeryView','CmdRequeryView')
Junk.Show()

read events

**----------------------------------------------------------------------------DEFINE CLASS oJunkForm AS Form
Height = 350
Width = 600
FUNCTION LOAD
CLOSE DATA ALL
OPEN DATA 'c:\vfp\samples\tastrade\data\tastrade'
SET DATA TO TasTrade
ENDFUNC
ENDDEFINE

**----------------------------------------------------------------------------
DEFINE CLASS CmdQuit AS CommandButton

Caption = 'Quit'
Left = 300
Top = 300
Visible = .T.

FUNCTION Click
THISFORM.RELEASE()
CLEAR EVENTS
ENDFUNC
ENDDEFINE

**----------------------------------------------------------------------------
DEFINE CLASS CmdRebuildGrid AS CommandButton

Caption = 'Rebuild Grid'
Left = 200
Top = 300
Visible = .T.

FUNCTION Click
=RebuildGrid()
ENDFUNC
ENDDEFINE

**----------------------------------------------------------------------------
DEFINE CLASS CmdRequeryView AS CommandButton

Caption = 'Requery View'
Left = 100
Top = 300
Visible = .T.

FUNCTION Click
=RequeryView()
ENDFUNC
ENDDEFINE

**----------------------------------------------------------------------------
**----------------------------------------------------------------------------
Function RequeryView()
=requery('Customers')
ENDFUNC
**----------------------------------------------------------------------------
**----------------------------------------------------------------------------
FUNCTION RebuildGrid()

if type('junk.ogrid')='O'
Junk.removeobject('ogrid')
release ogrid
endif
createobject('ogrid')
Junk.Addobject('oGrid','ogrid')

ENDFUNC
**-----------------------------------------------------------------------
**-----------------------------------------------------------------------
DEFINE CLASS oGrid as grid
** SETTING PROPERTIES
RecordSource = "Customers"
Visible = .T.
Width = 500
** DEFINING FUNCTIONS
FUNCTION INIT
SET DATA TO TasTrade
IF NOT USED("Customers")
USE 'Customer Listing' IN 0 ALIAS Customers
ELSE
=REQUERY("Customers")
ENDIF
SELECT Customers

ENDDEFINE
**-----------------------------------------------------------------------------
--
Cathy Ciciulla Neppel
Tenaska Marketing Ventures
Omaha, NE
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform