Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Modify keyword search code so enter key performs click

Posted on 2014-03-29
3
Medium Priority
?
149 Views
Last Modified: 2014-04-03
Software vb.net: Windows application.

Private Sub TextBoxSearch_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs)

        If (e.KeyCode = Keys.Enter) Then
            FilterProducts()
        End If

    End Sub

    Private Sub FilterProducts()

        If (TextBoxSearchC.Text = "") And TextBoxSearchP.Text = "" Then 'And TextBoxSearchL.Text = "" And TextBoxSearchF.Text = "" And TextBoxSearchT.Text = "" And TextBoxSearchB.Text = "" And TextBoxSearchCM.Text = "" Then
            MyTableBindingSource.RemoveFilter()
        Else
             MyTableBindingSource.Filter = "CompanyName like '" + TextBoxSearchC.Text + "%'" + "and PlanNumber like '" + TextBoxSearchP.Text + "%'" '+ "and Location like '" + TextBoxSearchL.Text + "%'" + "and FixtureType like '" + TextBoxSearchF.Text + "%'" + "and TrimType like '" + TextBoxSearchT.Text + "%'" + "and NumberBaths like '" + TextBoxSearchB.Text + "%'" + "and Comments like '" + TextBoxSearchCM.Text + "%'"
        End If

    End Sub

    Private Sub ButtonSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSearch.Click

        FilterProducts()
        Me.TextBoxSearchC.Clear()
        Me.TextBoxSearchP.Clear()

    End Sub

Open in new window

0
Comment
Question by:dave_sky
[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
3 Comments
 
LVL 64

Accepted Solution

by:
Fernando Soto earned 2000 total points
ID: 39964427
Hi dave_sky;

Do you wish to invoke the ButtonSearch_Click event when you press the Enter key while in the TextBoxSearch? If so then this should do it.

If (e.KeyCode = Keys.Enter) Then
    ButtonSearch.PerformClick( )
End If

Open in new window

0
 

Author Closing Comment

by:dave_sky
ID: 39975863
Thanks!
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 39975917
Not a problem, glad to help.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

609 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