?
Solved

Modify keyword search code so enter key performs click

Posted on 2014-03-29
3
Medium Priority
?
148 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 63

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 63

Expert Comment

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

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

765 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