Results 1 to 4 of 4

Thread: Req: How to use enter key for result and clear field

  1. #1

    Thread Starter
    Hyperactive Member jokerfool's Avatar
    Join Date
    Dec 2006
    Location
    Gold Coast, Australia
    Posts
    452

    Resolved Req: How to use enter key for result and clear field

    This is the code for the search command when hitting the button

    Code:
        Private Sub btnMobileDeviceFilter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMobileDeviceFilter.Click
            ds.Tables(0).DefaultView.RowFilter = "[Mobile_Phone_Type] like '%" & tbMobileDevice.Text & "%'"
            DataGridView1.DataSource = ds.Tables(0)
        End Sub
    If I double click the field and add

    Code:
    ds.Tables(0).DefaultView.RowFilter = "[Mobile_Phone_Type] like '%" & tbMobileDevice.Text & "%'"
            DataGridView1.DataSource = ds.Tables(0)
    When I enter text it locates the desired findings.

    Also how can I create a button to execute to clear the field of the box?

    Thank you
    Last edited by jokerfool; Mar 4th, 2013 at 01:59 AM.

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Req: How to use enter key for result and clear field

    Code:
    tbMobileDevice.Text = ""

  3. #3

    Thread Starter
    Hyperactive Member jokerfool's Avatar
    Join Date
    Dec 2006
    Location
    Gold Coast, Australia
    Posts
    452

    Re: Req: How to use enter key for result and clear field

    Yeah I just worked that out myself as well. Thank you.

  4. #4
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Req: How to use enter key for result and clear field

    If you by your first question means that you want the code for your btnMobileDeviceFilter to run when you hit the enter key then simply make the it the default button. In the Form designer select your Form and set the AcceptButton property to the btnMobileDeviceFilter button.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width