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:[email protected]] 
Sent: Tuesday, 23 January 2018 4:05 PM
To: NZ Borland Developers Group - Delphi List <[email protected]>
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 <[email protected] 
<mailto:[email protected]> > 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.

 



 

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        <http://www.gsds.co.nz/> www.gsds.co.nz

Mob: +64 (0)21 181 3367 <tel:+64%2021%20181%203367> 

Email:    [email protected] <mailto:[email protected]> 

Skype: errol_anderson

 



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: [email protected] <mailto:[email protected]> 
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [email protected] 
<http://net.nz>  with Subject: unsubscribe

 

_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: [email protected]
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [email protected] with 
Subject: unsubscribe

Reply via email to