views:

839

answers:

5

My program written with Delphi 7 compiles OK, but when I run it it gives me the error message:

Project1.Exe raised exception class EReadError with Message 'Property Persistence does Not Exist'. Process Stopped.

This only started after I installed the TMS Component Pack to use with this project. Thanks for any help.

A: 

Set a breakpoint(F5) and step the program(F7/F8).Get to the location where you get that exception and then give us more information about it(show some code).

John
You'll never get that far. The error is caused by the runtime itself streaming in the dfm as it trys to create your form.
Ken White
A: 

This error means that it's trying to load something (usually a form) from a DFM resource and it comes up with a value for a property that the component it's creating doesn't have.

If it only happened when you started using TMS components, the solution is simple: don't use them. Send as much information as you can about the error and the project that caused it to the authors and see if they can find a way to fix it. Until then, use something else.

Mason Wheeler
+4  A: 
  1. Open the Form in Delphi IDE
  2. Use Alt + F12 to edit the .DFM source
  3. Search the "Persistence" property
  4. Delete the line with "Persistence" property

DFM example:

SomeComponent1 = TSomeComponent
  OtherProperty = OtherValue
  Persistence = True
  AnotherProperty = AnotherValue
end

Also you can use the great DFMCheck 1.4 tool, by Andreas Hausladen. To check any other missing property like that:

http://andy.jgknet.de/blog/?page_id=177

This is most likely caused by the compiled & installed package being out of sync with the actual .pas file. If you have source code then rebuilding the packages will probably fix it.

Cesar Romero
@Cesar: You posted the same answer I was writing so I merged mine with yours. Good work! I had forgotten about DFMCheck though. Nice touch.
Jim McKeeth
This works, but only if you know which form it is that's causing the problem. You can find that out from examining the call stack when the exception gets raised, but it gets messy. Delphi's DFM loading code is not fun to trace through.
Mason Wheeler
@Jim: Thank you!@Mason: That is why I suggest DFMCheck. The DFMCheck Tool can check all .dfm files in project.
Cesar Romero
If necessary, you can use the windows FindStr (basically grep) utility: FINDSTR /is Persistence *.dfm
Gerry
A: 

If you're using text DFMs (right click on the form, check "Text DFM", save), you can use Search|Find in Files to find all instances of Persistence in your DFM files. Just set the search string to "Persistence" (I usually tell it to ignore case), the file mask to "*.dfm", and check the "All files in project" checkbox.

If you're not already using text DFMs and don't want to manually open all forms and check the box and then resave them, you can use CONVERT.EXE (in the ($DELPHI)\Bin folder) to convert them en-masse. Run CONVERT with no parameters from any command prompt to see the options. By default, CONVERT will save .DFM as .txt, but you can have it work in-place (rewriting the binary .DFM as the text .DFM) by using the -i switch. (I usually back up the .DFMs to a different folder first, then convert them. If no errors are reported, I can then delete the backed up .DFMs later.)

Ken White
A: 

I had similar problem with TMS when I upgraded to a new version:

If you think that some particular component is causing the problem, delete it , compile project without it, place it on the form/frame again.

If that doesn't work for you:

Things you need to do in order to fix the problem , so you can use Designer and new properties, because that's what you really want , don't you ? :-) :

  • Uninstall TMS Component Pack ( or whatever you're using )
  • Re-Install TMS Component Pack
  • Build & Install the packages
  • Add appropriate TMS .lib files to your Application Project ( I'm using C++ Builder )
  • Add appropriate TMS .pas files to your Application Project . For example I had a problem with TAdvSmoothCalendar component , so I've added the AdvSmoothCalender.pas to my project.

Cheers! I hope it works for everyone with a similar problem :)

dempl_dempl