Topic: TextBox display

Hello everyone, I have a problem with the date and time formats. I would like to display a date from a DateTimePicker1 in a textbox and the same for the time but separately. The dates DateTimePicker1 and 2 are in an "Add" form and the display is in the main form.
How to display them in TextBoxes.

Salut à tous, j'ai un problème aves les formats date et heures. Je voudrais afficher une date a partir d'un DateTimePicker1 dans un textbox et pareil pour l'heure mais séparément. Les dates DateTimePicker1 et 2 se trouve dans un formulaire "Ajout" et l'affichage se trouve dans le formulaire principal.
Comment faire pour les afficher dans les TextBox

Post's attachments

Attachment icon Date.jpg 2.53 kb, 66 downloads since 2022-05-27 

Destiny

Re: TextBox display

Hi Destiny,


If I understand your question, you could use the form's OnShow event with something like:

Form1.Edit1.Text := FormatDateTime('yyyy-mm-dd',Form1.DateTimePicker1.DateTime);
Form1.Edit2.Text := FormatDateTime('hh:mm:ss',Form1.DateTimePicker2.DateTime);

-joshuA

"Energy and persistence conquer all things."

Re: TextBox display

Great joshua, that's exactly what I wanted.
Thank you so much.

Destiny

4 (edited by Destiny 2022-05-27 11:00:55)

Re: TextBox display

the DatePicker is displayed well but it is the system date and time that is written in the TextBox and not the one that I decide.

les DatePicker s'affiche bien mais c'est la date et l'heure système qui est inscrites dans les TextBox et non celle que je décide.

Destiny

5 (edited by lemodizon 2022-05-27 11:46:44)

Re: TextBox display

joshuA wrote:

Hi Destiny,


If I understand your question, you could use the form's OnShow event with something like:

Form1.Edit1.Text := FormatDateTime('yyyy-mm-dd',Form1.DateTimePicker1.DateTime);
Form1.Edit2.Text := FormatDateTime('hh:mm:ss',Form1.DateTimePicker2.DateTime);

-joshuA


Hi joshua,

thanks i learned new syntax from you.



thanks again.

-lemodizon

Re: TextBox display

I still have the same problem, on 'Form2' I enter the date that I want to see displayed on 'Form1' but it is always the system date that is displayed.

J'ai toujours le même problème, sur 'Form2' je rentre la date que je veut voir afficher sur 'Form1' mais c'est toujours la date du système qui s'affiche.

Post's attachments

Attachment icon Date Form1 et 2.jpg 16.07 kb, 58 downloads since 2022-05-27 

Destiny

Re: TextBox display

Destiny,

Somehow, you will need to reference the same date field on Form1 as on Form2.  Without seeing your situation, it's hard to make suggestions.  I have provided another example that might be helpful.


Glad it was helpful for you lemodizon.

-joshuA

Post's attachments

Attachment icon 8145_v1.zip 325.97 kb, 130 downloads since 2022-05-27 

"Energy and persistence conquer all things."

8 (edited by Destiny 2022-05-27 13:51:48)

Re: TextBox display

Here is an example of my program

Voici un exemple de mon prog

Post's attachments

Attachment icon Ma pêche.zip 1.65 mb, 124 downloads since 2022-05-27 

Destiny

Re: TextBox display

joshuA wrote:

Destiny,

Somehow, you will need to reference the same date field on Form1 as on Form2.  Without seeing your situation, it's hard to make suggestions.  I have provided another example that might be helpful.


Glad it was helpful for you lemodizon.

-joshuA


Hi joshua,

it works. Thank you

Post's attachments

Attachment icon date.PNG 14.78 kb, 61 downloads since 2022-05-27 

-lemodizon

Re: TextBox display

Destiny wrote:

Here is an example of my program

Voici un exemple de mon prog

Hi Destiny,

the sample file of joshua works in my project.

you can try also this file see the attached file.... derek send it to me it is working on project file also.

Post's attachments

Attachment icon date as text.zip 336.3 kb, 134 downloads since 2022-05-27 

-lemodizon

Re: TextBox display

Destiny,

Two of the fish didn't have date / time, but this loads the last one.

You will need to format the string based on the sqlite strftime.  I added a link in the comments.

-joshuA

Post's attachments

Attachment icon Ma pêche_v2.zip 1.63 mb, 124 downloads since 2022-05-27 

"Energy and persistence conquer all things."

Re: TextBox display

hi Destiny,

i'm not sure if  this is the output you expect to display in your program?

Post's attachments

Attachment icon Capture.PNG 16.37 kb, 63 downloads since 2022-05-27 

-lemodizon

Re: TextBox display

Great, it works very well. I added the hours separately and everything is fine, now I have a date field and a time field.
Thank you so much. I wish you a good weekend.

Super, ca fonctionne très bien. J'ai rajouter les heures a part et tout va bien, maintenant j'au un champ date et un champ heure.
Merci beaucoup. Je te souhaite un bon week-end.

Post's attachments

Attachment icon Date Form1 et 2.jpg 6.58 kb, 62 downloads since 2022-05-27 

Destiny