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
On E : Exception do
dxmdiFormA := False;
end else begin
frmFormA := TfrmFormA.Create(nil, Huii);
dxmdiFormA := True;
the variable dxmdiFormA (boolean) is defined globally and set as false.
Can any one tell me what is wrong?