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;

Recommended Answers

All 10 Replies

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.

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?

Remove all your *.~* and *.dcu files and any other files that will be regenerated and try to build from scratch

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;

I suspect you are using "while not .tblYourTable.Eof do" // Everything below

I which event, if you are not careful with the code that follows, you will get EXACTLY that result.

Have a look at this ..

with tblYourTable do
begin
.tblYourTable.DisableControls;
try
FBookMark := tblYourTablel.GetBookmark;{ Note record no}
tblYourTable.First; // Go to the first record
while not tblYourTablel.Eof do // Everything below between the Begin and End will execute until you reach the end of the file (EOF)
begin
if tblYourTableSomething.value = Whatever then
begin

end;
// ShowMessage('tblYourTableSomething = ' + (tblYourTableSomething.value));
tblYourTable.Next;
end;
finally
tblYourTable.GotoBookmark(FBookMark); // Take pointer back to where it was.
tblYourTable.FreeBookMark(FBookMark) ;{Deallocate memory for the bookmark}
tblYourTable.EnableControls;
end;
end;

Heavens sake Delphiman, please read the stickies, and start using code tags

Heavens sake Delphiman, please read the stickies, and start using code tags

Heavens sake Liz [whomever the Hell you are!] PULL YOUR HEAD IN!!

I have specilized in Delphi [probably] since you were still wearing short dresses; since Delphi was released by Borland in 1990.

If you don't like my solutions - don't read them!

They are intended to help others and I don't generally have the time or notion to deal with the irrelevant drivel of 14-year olds who are carried away with their self-elected importance!

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.

LiZ this is GOING to be the final response on this website.

I closing I would mention that you could be a lot more constructive and helpful if you explained what the Hell a "Stikie" and a "code tag" is that you are fussing about.

I am not familiar with them as I hardly ever come to this website and your attitude is no encouragement to return - EVER.

For starters I am put off by a smiley suddenly being forced into one of my code-solutions - which I caanot remove.

Please don't abuse this [otherwise] excellent and well-intended website any further with your smart-ass comments. If you have anything further say to me have the BALLS to send them to me at [email removed]

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.

>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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.