Solved

Modify keyword search code so enter key performs click

Posted on 2014-03-29
3
139 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
  • 2
3 Comments
 
LVL 62

Accepted Solution

by:
Fernando Soto earned 500 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 62

Expert Comment

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

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

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…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

758 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

23 Experts available now in Live!

Get 1:1 Help Now