General information
Title:
Attn MS:Reproducible C5 Error
If MS is listening:
I've got myself another reproducible C5 error. This time it involves accessing a project property.
In order to reproduce, load up VFP in a clean directory. Copy in a project, and build a simple table named PrjInfo with one field, "cAppName", with one record. The field "CAppName" gets the name of the project, no extension. IOW, project "Test.VCX" would go into PrjInfo.cAppName as "TEST".
Execute these commands from the command window:
loProject = .NULL.
? TestC5(@loProject)
The TestC5 code looks like this:
----BEGIN TESTC5.PRG FILE -------
LPARAM loProject
LOCAL woPrjInfo,lnSele0,llReturnValue,lcProjName
lnSele0 = SELE(0)
woPrjInfo = USED("prjInfo")
IF ! woPrjInfo
SELE 0
USE PrjInfo SHARE IN 0
ENDIF
lcProjName = ALLT(UPPER(cAppName))
IF ! woPrjInfo
USE IN prjInfo
ENDIF
SELE (lnSele0)
* Find out if project is already open
*
FOR each oProj in Application.Projects
IF oProj.Name = m.lcProjName
loProject = oProj
llReturnValue = .t.
EXIT FOR
ENDIF
ENDFOR
* If not open, open it NOSHOW, and get a pointer
IF ! llReturnValue
MODI PROJ (m.lcProjName) NOSHOW NOWAIT
FOR each oProj in Application.Projects
*
* C5 on the next line
*
IF oProj.name = m.lcProjName &&--C5 on this line
loProject = oProj
EXIT FOR
ENDIF
ENDFOR
ENDIF
RETURN llReturnValue
----------END TestC5.PRG File-----------
I will occassionally get, instead of C5, the VFP message "Property Not found." I presume it means it can't find oProj.name
I have eliminated it by both removing the conditional table open at the top and by replacing the two instances of:
IF oProj.Name = m.lcProjName
With
IF JustStem(UPPER(oProj.Name)) == m.lcProjName
Of course, it does not make sense to me that either of these would solve the problem, but it seems to work.
P.S. Sorry that the code is not very readable, I haven't figured out yet how to keep UT from converting my entire message into proportional font and removing all of my tabs and spaces.
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only