how to use DateTimePicker

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 4 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
Domtar
Posts: 133
Last visit: Mon Mar 11, 2024 5:38 am
Has voted: 2 times

how to use DateTimePicker

Post by Domtar »

To help you better we need some information from you.

*** Please fill in the fields below. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***

Product, version and build: PS Studio 2020 5.7.172
32 or 64 bit version of product: 64-bit
Operating system: windows 10
32 or 64 bit OS: 64-bit

*** Please add details and screenshots as needed below. ***

DO NOT POST LICENSES, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM

I've started creating GUIs not long ago and things were going perfectly right until I tried using the DateTimePicker.

I've created a simple GUI with a DateTimePicker, a Click Me button, and a textbox. When I click the button, the date in the Picker is shown into the Textbox. This works as expected.

But when I click on the Down Arrow to the right of the DateTimePicker, there is a small delay and my GUI closes.

What am I doing wrong?

Thank you!
User avatar
Alexander Riedel
Posts: 8478
Last visit: Tue Mar 26, 2024 8:52 am
Answers: 19
Been upvoted: 37 times

Re: how to use DateTimePicker

Post by Alexander Riedel »

[Topic moved by moderator]
Alexander Riedel
SAPIEN Technologies, Inc.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: how to use DateTimePicker

Post by jvierra »

You will need to upload your PSF file as the explanation does not have enough information to understand what is happening.

First check you code carefully. A missing or extra bracket can cause code to execute incorrectly.

You can also run in the debugger and step through the code to see what is being executed.
User avatar
Domtar
Posts: 133
Last visit: Mon Mar 11, 2024 5:38 am
Has voted: 2 times

Re: how to use DateTimePicker

Post by Domtar »

there is virtually no code, so I doubt the bug is there.

$form1_Load={
}

$button1_Click={
$textbox1.Text = $datetimepicker1.Value
}

Clicking the button displays today's date in the textbox. But clicking the down arrow in the datetimepicker control, instead of displaying the calendar with the current month as expected with any Windows app, the script closes.

Same behavior with debugger, I click the down arrow, it closes without any error or message.

Could it be because my pc's regional settings are set to french canadian, even though the display is english?

Thanks!
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: how to use DateTimePicker

Post by jvierra »

Without a code example it is not possible to guess at what is wrong. Somewhere you have bad code. We can only tell what it is by seeing the code.

Create a simple form with only the DTP and your button and test it.

No. Language has no effect on how cod executes in a computer. Computers speak binary and what you see on the screen is just a translation for your convenience.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: how to use DateTimePicker

Post by jvierra »

Domtar wrote: Tue Feb 11, 2020 5:06 am there is virtually no code, so I doubt the bug is there.

$form1_Load={
}

$button1_Click={
$textbox1.Text = $datetimepicker1.Value
}

Clicking the button displays today's date in the textbox. But clicking the down arrow in the datetimepicker control, instead of displaying the calendar with the current month as expected with any Windows app, the script closes.

Same behavior with debugger, I click the down arrow, it closes without any error or message.

Could it be because my pc's regional settings are set to french canadian, even though the display is english?

Thanks!
Are you saying that is the only code in your PSF?
User avatar
Domtar
Posts: 133
Last visit: Mon Mar 11, 2024 5:38 am
Has voted: 2 times

Re: how to use DateTimePicker

Post by Domtar »

yes that is eactly what i'm saying.

i did a small GUI just to test that control and that is the only code.
User avatar
Domtar
Posts: 133
Last visit: Mon Mar 11, 2024 5:38 am
Has voted: 2 times

Re: how to use DateTimePicker

Post by Domtar »

as a test, I added these lines;

$datetimepicker1_DropDown={
$textbox1.Text = 'test'
}

when i click the drop-down arrow, i do see "test" written to the textbox, but instead of displaying the calendar as expected, the form closes.

someone has an idea what is going wrong?

thanks!
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: how to use DateTimePicker

Post by jvierra »

Please upload your PSF file.
User avatar
Domtar
Posts: 133
Last visit: Mon Mar 11, 2024 5:38 am
Has voted: 2 times

Re: how to use DateTimePicker

Post by Domtar »

here's the psf.
Attachments
1.psf
(12.49 KiB) Downloaded 160 times
This topic is 4 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked