Solved

Making "donk" sound when pressing enter

Posted on 2008-06-16
5
708 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

759 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

18 Experts available now in Live!

Get 1:1 Help Now