Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Making "donk" sound when pressing enter

Posted on 2008-06-16
5
Medium Priority
?
787 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…
Suggested Courses

886 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