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

SET TEXTMERGE TO MEMVAR not working

Status
Not open for further replies.

wgcs

Programmer
Mar 31, 2002
2,056
EC
I haven't been able to determine the circumstances, but when called, the SerializeObject function in thread184-805859 doesn't change the Textmerge'd memvar at all, thereby returning .F.

Does anyone know of what circumstances might cause the "SET TEXTMERGE TO MEMVAR lcOut" to not work?
 
Found the problem. In the help on TRY..CATCH, it says:
Avoid using the SET TEXTMERGE TO MEMVAR command within a TRY...CATCH...FINALLY structure because the memory variable will be lost if an error occurs in the statement.

Now, I really expected that meant not to SET TEXTMERGE TO MEMVAR inside the TRY..CATCH..FINALLY, but I found that if an exception is caught, the SET TEXTMERGE is un-done, even though the SET TEXTMERGE started before the TRY.

I don't like it....

(ps: Anyone know where to submit suggestions on improving the VFP help file??)
 
I looked back, and noticed that I didn't even have the TRY..CATCH processing in the Serialize code in the Thread184-805859.

I had added it around:
Code:
    lvData = EVALUATE('toObj.'+lcProp)
so that it became (the red is what I added to solve the problem described above):
Code:
  lvData = 'Error Serializing'
  TRY
    lvData = EVALUATE('toObj.'+lcProp)
  CATCH TO oExc
    lvData = 'Error Serializing'
    * Ignore Error
    [COLOR=red]* fix the SET TEXTMERGE that was un-done by CATCH
    SET TEXTMERGE TO MEMVAR m.lcOut ADDITIVE[/color]
  ENDTRY
  IF VARTYPE(lvData)='C' AND lvData=='Error Serializing'
    LOOP
  ENDIF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top