Execution jumps over code.
Hello,
My problem is the execution jumps over a lot of code.
In my example it jumps from "if" to the last end;, without executing anycode inbetween.
Why?
I had no "if" before and the one line was executed before the procedure was ended.
No error message is returned.
All ideas and help is very much appreciated.
procedure TFrmTranslate.ExportAsTextfileClick(Sender: TObject);
begin
if fileExists(FrmTranslate.FileListBox.FileName) then
begin
.
.
.
end
else
showmessage('Can not find file: ' + FrmTranslate.FileListBox.FileName);
end;
AKJo
Junior Poster in Training
59 posts since Jan 2008
Reputation Points: 10
Solved Threads: 0
Usually it would do that if an error occurs such as FrmTranslate is not valid, but you would see an error to go with.
Other reasons would be that somewhere between the begin and end you've masked out you have an imbalance in begins and ends.
LizR
Posting Virtuoso
1,791 posts since Aug 2008
Reputation Points: 196
Solved Threads: 190
I made some tests:
1. Took away the "if" sentence. The execution jumped over the complete routine, to end;, then BACK to after the deleted "if" and executed it all.
2. I then inserted the "if" sentence again and it all seems to work.
My worry is now: for how long will it work? and why? It used to work in the beginning, then failed. I'm out of control and I hate that.
Any more ideas to test?
AKJo
Junior Poster in Training
59 posts since Jan 2008
Reputation Points: 10
Solved Threads: 0
Remove all your *.~* and *.dcu files and any other files that will be regenerated and try to build from scratch
pritaeas
Posting Expert
5,480 posts since Jul 2006
Reputation Points: 653
Solved Threads: 874
Heavens sake Delphiman, please read the stickies, and start using code tags
LizR
Posting Virtuoso
1,791 posts since Aug 2008
Reputation Points: 196
Solved Threads: 190
Nice judegement, considering Ive been using turbo pascal and then moved on to delphi so a total over over 21 years.
PS delphi 1 was released in 1995.
LizR
Posting Virtuoso
1,791 posts since Aug 2008
Reputation Points: 196
Solved Threads: 190
Stickies - the marked threads that remain at the top of a forum, which are marked there specifically to be read. In this case, marked at the top of the forum post list with the big word "Announcement", there are 2 of them.
code tags - explained in the stickie
smiley in code - solved by use of code tags, which is why the original poster (or OP to forum savvy people) didnt suffer from it in their code.
As for balls, I have plenty, however, I dont feel the need to share my private email address with you so you can rant away.
The forum rules specifically asked for you to use code tags, and dredging up old posts is usually considered bad forum manners.
LizR
Posting Virtuoso
1,791 posts since Aug 2008
Reputation Points: 196
Solved Threads: 190
>I have specilized in Delphi [probably] since you were still wearing
>short dresses; since Delphi was released by Borland in 1990.
1) How long you've been working with a language has no bearing on following Daniweb's rules. Since you're (so you claim) not a child, we expect you to be professional enough to read and follow our rules before attempting to flame another member.
2) Daniweb is not a bullshitocracy. If you want respect, earn it. Nobody is going to bend over and kiss your feet if all you do is talk big. We have d-bags aplenty, and until you prove that you're worth respecting, expect to be treated as one of them. Your attitude thus far isn't helping at all.
>If you don't like my solutions - don't read them!
If you post solutions that aren't readable (ie. no code tags (ie. no formatting (ie. get your head out of your ass and read our rules))) then don't expect anyone to read them. If you truly care about helping people, you'll make your posts as accessible as possible so that complete noobs can understand what you're saying.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401