Ok, I have two forms in my project (well more actually, but they don't matter here). There is a button on the first one to go to the second one and when the second one is closed, the first one is displayed again.
On the second form is an OpenDialog that is called from a menu option. If this is done when running the program it does what it is meant to, but the first form displays a 'file not found' error when it executes a bit of code (shown below) to open the debug file to write what's happening to. No other circumstances trigger this error and I can't see why this should.
Code:
On the second form is (in the appropriate menu click event):
dlgLoad.InitialDir := DataDir;
dlgLoad.DefaultExt := '*.dbd';
dlgLoad.Filter := 'DeckBuild deck|*.dbd';
If dlgLoad.Execute then
begin
//A load of code commented out to see if it was the problem
end;
In the FormShow event of the first form:
If Debug then
begin
AssignFile(OutFile, 'Debug.txt');
Append(OutFile);
Writeln(OutFile, 'Opened Menu');
Writeln(OutFile);
Flush(OutFile);
end;
It dies on the Append with the message 'File not found'. This same file is successfully opened and written in many places, it this error only occurrs if the OpenDialog is executed, nothing else makes it happen. Any ideas anyone?
On the second form is an OpenDialog that is called from a menu option. If this is done when running the program it does what it is meant to, but the first form displays a 'file not found' error when it executes a bit of code (shown below) to open the debug file to write what's happening to. No other circumstances trigger this error and I can't see why this should.
Code:
On the second form is (in the appropriate menu click event):
dlgLoad.InitialDir := DataDir;
dlgLoad.DefaultExt := '*.dbd';
dlgLoad.Filter := 'DeckBuild deck|*.dbd';
If dlgLoad.Execute then
begin
//A load of code commented out to see if it was the problem
end;
In the FormShow event of the first form:
If Debug then
begin
AssignFile(OutFile, 'Debug.txt');
Append(OutFile);
Writeln(OutFile, 'Opened Menu');
Writeln(OutFile);
Flush(OutFile);
end;
It dies on the Append with the message 'File not found'. This same file is successfully opened and written in many places, it this error only occurrs if the OpenDialog is executed, nothing else makes it happen. Any ideas anyone?