[DUG] Error loading form

David O'Brien Dave at iccs.co.nz
Wed Jan 24 14:43:10 NZDT 2018


I have had a similar problem in the past and had to recreate the project, adding the forms to a new project sorted it.

From: delphi-bounces at listserver.123.net.nz [mailto:delphi-bounces at listserver.123.net.nz] On Behalf Of Karl Reynolds
Sent: Wednesday, 24 January 2018 2:32 pm
To: NZ Borland Developers Group - Delphi List <delphi at listserver.123.net.nz>
Subject: Re: [DUG] Error loading form

Something wrong in the dpr then?

Cheers,
Karl

On Wed, Jan 24, 2018 at 2:09 PM, Errol Anderson <errol.anderson at gsds.co.nz<mailto:errol.anderson at gsds.co.nz>> wrote:
Hi Karl

Thanks for the conversion code – however, my dfm is text, sorry I did not confirm this earlier.  I have reviewed the dfm – all 12,000+ lines but nothing obvious.  I believe the cause of the form-loading error is more subtle than a detectable error in the dfm text, as the program compiles and displays the form.  What puzzles me is that I have reverted to versions from the _history folder which were previously working correctly, and still get the error.

Regards

Errol



From: Karl Reynolds [mailto:kreynolds at chocfishsoft.co.nz<mailto:kreynolds at chocfishsoft.co.nz>]
Sent: Tuesday, 23 January 2018 4:05 PM
To: NZ Borland Developers Group - Delphi List <delphi at listserver.123.net.nz<mailto:delphi at listserver.123.net.nz>>
Subject: Re: [DUG] Error loading form

If your form is a binary form (as David said, text is recommended because of situations like this), you can convert it to text by creating a new form with a button that uses ObjectBinaryToText.

LMemoryStream := nil;
LFileStream := nil;
LMyForm := TMyForm.Create; // TMyForm is the form you want a text version of
try
  LMemoryStream := TMemoryStream.Create;
  LMemoryStream.WriteComponent(LMyForm);
  LMemoryStream.Position := 0;
  LFileStream := TFileStream.Create('c:\yourformname.dfm'); // or wherever you want to put it and whatever you want to call it
  ObjectBinaryToText(LMemoryStream, LFileStream);
finally
  LMemStream.Free;
  LFileStream.Free;
  LMyForm.Free;
end;

Cheers,
Karl

On Tue, Jan 23, 2018 at 2:31 PM, Errol Anderson <errol.anderson at gsds.co.nz<mailto:errol.anderson at gsds.co.nz>> wrote:
After a (worrying) computer crash, it appeared that my main form, main.pas, was corrupted.  So I reverted to main.pas and main.dfm which I had committed to the git server last night.

Now when I open the project or the main form using Delphi XE10.1, I get the following error, and I cannot display the form on  pressing F12.

[cid:image001.png at 01D39521.A603E990]

However, the program compiles and displays the form when I run it, so it looks like main,dfm is substantially OK.

Any ideas how I can retrieve the form would be most welcome.

Thanks and regards

Errol

Errol Anderson
Geothermal Resource Analyst | Software Development
GSDS Ltd       www.gsds.co.nz<http://www.gsds.co.nz/>
Mob: +64 (0)21 181 3367<tel:+64%2021%20181%203367>
Email:    errol.anderson at gsds.co.nz<mailto:errol.anderson at gsds.co.nz>
Skype: errol_anderson

[Logo_final2_90]
This communication and any attached material contains confidential information intended only for the use of the addressee named above. No confidentiality is waived or lost by any mistaken transmission to you. If you have received this message in error please delete the document and notify us immediately.


_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi at listserver.123.net.nz<mailto:delphi at listserver.123.net.nz>
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-request at listserver.123.net.nz<http://net.nz> with Subject: unsubscribe


_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi at listserver.123.net.nz<mailto:delphi at listserver.123.net.nz>
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-request at listserver.123.net.nz<mailto:delphi-request at listserver.123.net.nz> with Subject: unsubscribe

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20180124/61d8a47f/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 2504 bytes
Desc: image001.png
Url : http://listserver.123.net.nz/pipermail/delphi/attachments/20180124/61d8a47f/attachment-0001.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.jpg
Type: image/jpeg
Size: 4499 bytes
Desc: image002.jpg
Url : http://listserver.123.net.nz/pipermail/delphi/attachments/20180124/61d8a47f/attachment-0001.jpg 


More information about the Delphi mailing list