i press enter on my forms and they close

Ask your Windows PowerShell-related questions, including questions on cmdlet development!
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.
Locked
User avatar
jsira2003@yahoo.com
Posts: 112
Joined: Fri Apr 07, 2017 9:47 am

i press enter on my forms and they close

Post by jsira2003@yahoo.com » Mon Nov 26, 2018 11:09 am

I am sure this is a simple problem to resolve. Unfortunately the resolve didn't come to me. How can I resolve this so instead of the form closing it will advance to the next data entry field.

thank you,
John

User avatar
jvierra
Posts: 13682
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: i press enter on my forms and they close

Post by jvierra » Mon Nov 26, 2018 11:59 am

You have to remove the default button which will always click when return is entered.

User avatar
Alexander Riedel
Posts: 7003
Joined: Tue May 29, 2007 4:43 pm

Re: i press enter on my forms and they close

Post by Alexander Riedel » Mon Nov 26, 2018 2:44 pm

https://www.sapien.com/blog/2015/12/23/how-i-learned-to-love-dialogresult/
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
jsira2003@yahoo.com
Posts: 112
Joined: Fri Apr 07, 2017 9:47 am

Re: i press enter on my forms and they close

Post by jsira2003@yahoo.com » Mon Nov 26, 2018 6:16 pm

I looked for the dialogresult to set it to none. But it seems this assumes you have a button to click on otherwise you do not have a dialogresult to set. My form just has a red X in the upper right. I want the user to move through the fields and when they are done press the red x to exit. I do not want a return pressed key to exit the app.

I hope I have explained this well.

John

User avatar
jvierra
Posts: 13682
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: i press enter on my forms and they close

Post by jvierra » Mon Nov 26, 2018 6:26 pm

You created a dialog form and deleted the "Ok" button but the form is still terminating. Somewhere in your form you are processing the return key and exiting. Perhaps the OK button is hiding somewhere. Check the controls list to see if it is still on the form but hidden.

Locked