Solved

Making "donk" sound when pressing enter

Posted on 2008-06-16
5
760 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses
Course of the Month7 days, 17 hours left to enroll

617 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