Delphi beginners

Moderators: netgert
Number of threads: 358
Number of posts: 982

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Form show and close in one button click Posted by beginner725 on 5 Dec 2011 at 1:10 PM
Hello all,

I am a very new programmer. I have an image. I need to open a corresponding form on a mouse click and then if the user again clicks on the image the form needs to be closed. My code works for the first time it is opened and closed. But if i open again the form and then try to close it the second time , i get an error which says access violation, reading memory address 0x0000000.

if dxmdiFormA then begin
try
frmFormA.Close;
except
On E : Exception do
begin
ExceptionLog(E, Self);
dxmdiFormA := False;
end;
end;

end else begin

frmFormA := TfrmFormA.Create(nil, Huii);
dxmdiFormA := True;
end;

end;


the variable dxmdiFormA (boolean) is defined globally and set as false.

Can any one tell me what is wrong?

Thanks.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.