1 (edited by kweatherhead 2020-12-17 15:23:15)

Topic: UnExpected Error By Newbie

Greetings,

I am a newbie so this may totally be on me or have I found something?

I have been playing with Date & Time Examples and wanted to make a more specific demo to hold on to while I start my project.  I have been working off Form1 from an EditBox, simply using the OnClick Event to launch the code and everything was displayed via ShowMessage displays as to the results.

In the process I decided to move my code to a Button from the EditBox as no input is actually need, just a way to trigger the code.  However I get an error  "List index out of bounds (1)" when I run the exact same code that functions properly when deployed from the EditBox.

In my case is there really anything different about running the code between the EditBox and the Button?  I don't think so, but do not understand either.

See all info in project attached... I would like to understand why one work and the other doesn't.

Regards,
Keith

Post's attachments

Attachment icon DateTimeTesting.zip 343.71 kb, 185 downloads since 2020-12-17 

Re: UnExpected Error By Newbie

Keith,

You forgot to add the project to your post! smile

On a clear disk you can seek forever

Re: UnExpected Error By Newbie

Don't know why it didn't attach the first time,
there now...

Sorry,
Keith

4 (edited by derek 2020-12-17 16:35:45)

Re: UnExpected Error By Newbie

Hi Keith,
Maybe in cutting and pasting, the 'cancel: boolean' got removed (line 103).
Replace
procedure Form1_Button1_OnClick (Sender: TObject);
with
procedure Form1_Button1_OnClick (Sender: TObject; cancel : boolean);
I think that should fix your problem.
Derek.

Re: UnExpected Error By Newbie

Derek,

Yes it did fix the problem so the Button would execute the code properly...  it was never on the EditBox code
and if placed there does not seem to cause any issues either ???

Thanx,
Keith