Not at all the same. The button is never clicked. The form handles the keystrokes.
The point is it can only be done the way I posted. Any other method will not work in most scenarios.
Problem with Button and Pressing Enter
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.
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.
- dan.potter
- Posts: 709
- Last visit: Wed Nov 14, 2018 11:39 am
Re: Problem with Button and Pressing Enetr
"Thats the reason i want to "click" the button "uebernhmen + ..." with the enter key"
I guess I'm still lost, why can't we click the button with the enter key? see example, if the button is focused the enter key does the click event each time it is pressed.
I guess I'm still lost, why can't we click the button with the enter key? see example, if the button is focused the enter key does the click event each time it is pressed.
Re: Problem with Button and Pressing Enetr
Hw is saying he wants the button function to occur when he hits the enter key. I told him as he describes it, it cannot be done. If the button is in focus it can be activated in code or we can use the space bar to click it. TO make the enter key work we must assign the button as the forms "AcceptButton"
The code I posted does exactly what he wants. It allows enter to be used to enter text then a tab enter will operate the button. The button should not have any code. Place code in the windows "closing" event.
If you are curious about how forms work then look at the MSDN site on designing with Windows forms. There are a lot of explanations about how events work and info on standard way to do most things.
The code I posted does exactly what he wants. It allows enter to be used to enter text then a tab enter will operate the button. The button should not have any code. Place code in the windows "closing" event.
If you are curious about how forms work then look at the MSDN site on designing with Windows forms. There are a lot of explanations about how events work and info on standard way to do most things.
- dan.potter
- Posts: 709
- Last visit: Wed Nov 14, 2018 11:39 am
Re: Problem with Button and Pressing Enetr
That's exactly what I did without any special code or design configuration. Enter in the textbox adds stuff to the listbox. Tab then enter does the click event on the button. We can assign the dialogresult or script form.close(). Either way the enter key is the same as the mouse click on the button. This would be a whole lot easier to understand with code Perhaps we're missing an event?
Re: Problem with Button and Pressing Enetr
oh my goodness....what a shame....your posts made me realize what my problem WAS
i used button_MOUSEClick instead of button_Click......damnit, what a stupid mistake, the name already says it....
now i understand why you couldnt understand my problem, because i was asking for a basic function....
and you are right jvierra, i urgently need to become familiar with the forms.
thank u so much guys, nearly 35 posts for my problems, u are so fing awesome..
best wishes and thanks a lot u 2
i used button_MOUSEClick instead of button_Click......damnit, what a stupid mistake, the name already says it....
now i understand why you couldnt understand my problem, because i was asking for a basic function....
and you are right jvierra, i urgently need to become familiar with the forms.
thank u so much guys, nearly 35 posts for my problems, u are so fing awesome..
best wishes and thanks a lot u 2
- dan.potter
- Posts: 709
- Last visit: Wed Nov 14, 2018 11:39 am
Re: Problem with Button and Pressing Enter
It happens There was an earlier version of PS studio that had a bug in which it removed all the checkboxes for the events in the designer on export but kept the code. Left me scratching my head lots of times.
FYI double clicking the control in the designer automatically inserts the default event.
FYI double clicking the control in the designer automatically inserts the default event.