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.
User avatar
Domtar
Posts: 78
Meble kuchenne na zamówienie - na wymiar - Wrocław
Joined: Sun Mar 03, 2013 12:42 pm

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: 7265
Joined: Tue May 29, 2007 4:43 pm

Re: how to use DateTimePicker

Post by Alexander Riedel »

[Topic moved by moderator]
Alexander Riedel
SAPIEN Technologies, Inc.

jvierra
Posts: 14213
Joined: Tue May 22, 2007 9:57 am
Contact:

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: 78
Joined: Sun Mar 03, 2013 12:42 pm

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: 14213
Joined: Tue May 22, 2007 9:57 am
Contact:

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: 14213
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: how to use DateTimePicker

Post by jvierra »

Domtar wrote:
Tue Feb 11, 2020 6: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: 78
Joined: Sun Mar 03, 2013 12:42 pm

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: 78
Joined: Sun Mar 03, 2013 12:42 pm

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: 14213
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: how to use DateTimePicker

Post by jvierra »

Please upload your PSF file.

User avatar
Domtar
Posts: 78
Joined: Sun Mar 03, 2013 12:42 pm

Re: how to use DateTimePicker

Post by Domtar »

here's the psf.
Attachments
1.psf
(12.49 KiB) Downloaded 15 times

Locked