Solved

Making "donk" sound when pressing enter

Posted on 2008-06-16
5
717 Views
Last Modified: 2013-12-26
I'm using Visual Studio 2008 and I have textboxes on a form. When I press "enter" on this form it performs a search which fills a datagridview. After the operation is complete it makes a "donk" sound. How can I get the "donk" sound to go away when you press enter while the active control is a textbox?
0
Comment
Question by:beef137
  • 2
  • 2
5 Comments
 
LVL 31

Expert Comment

by:Frosty555
ID: 21793353
I don't have VS2008 on hand, but go to Control Panel->Sounds and audio devices->Sounds tab and see if visual studio has a section in the list of windows sounds. If it does you can customize / disable the sounds in that list.
0
 

Author Comment

by:beef137
ID: 21793385
Frosty,

Thanks for the response. But my compiled application makes this sound. Not just when Visual Studio is running.
0
 
LVL 10

Expert Comment

by:Clif
ID: 21793893
What event is responding to the "Enter" on the form?

Click event of the "accept" button?  Enter event of a textbox?
0
 

Author Comment

by:beef137
ID: 21794048
Private Sub SearchForm_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown

        If TypeOf Me.ActiveControl Is TextBox And e.KeyCode = Keys.Return Then
            SearchList()
        Else
            If TypeOf Me.ActiveControl Is DataGridView And e.KeyCode = Keys.Return Then
                OpenRecordSearch()
            End If
        End If

    End Sub
0
 
LVL 10

Accepted Solution

by:
Clif earned 500 total points
ID: 21794165
This seems to work:
Private Sub SearchForm_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
 

        If TypeOf Me.ActiveControl Is TextBox And e.KeyCode = Keys.Return Then

            e.SuppressKeyPress = True

            SearchList()

        Else

            If TypeOf Me.ActiveControl Is DataGridView And e.KeyCode = Keys.Return Then

                OpenRecordSearch()

            End If

        End If
 

    End Sub

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now