I have a program that runs a user search based on a textbox, when the user presses the enter key a new form is open and show all users find based on the textbox content.
Here is an example of my code :
$UserBadge_KeyDown = [System.Windows.Forms.KeyEventHandler]{
if ($_.KeyCode -eq 'Enter')
{
$_.Handled = $true
$_.SuppressKeyPress = $true
Show-FindUser_psf -User $UserBadge.text
}
}
I can't use the AcceptButton property on the MainForm neither than the Multiline on my textbox property and so it makes the windows "ding" sound when pressed.
Is there an other way to stop this sound ?
Use textbox to open form make sound
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.
Re: Use textbox to open form make sound
Thanks for your quick reply.
I made an exemple for demonstration.
In fact my script is more complex because I have an Active Directory search
You can find Screenshots of my interface in .zip file.
I made an exemple for demonstration.
In fact my script is more complex because I have an Active Directory search
You can find Screenshots of my interface in .zip file.
- Attachments
-
- test.zip
- (74.84 KiB) Downloaded 92 times
Re: Use textbox to open form make sound
Whenever you repurpose the return key then any change of focus will cause a bell sound. This is an unfortunate side effect of a dialog. I suggest using a button to open the subform and not using the enter key.
Re: Use textbox to open form make sound
That's what I was afraid to hear.
Thanks anyway for your time and your help.
Thanks anyway for your time and your help.