Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8100793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:50:20+00:00 2026-06-05T22:50:20+00:00

This is what I’m using to allow the enter button to start the search.

  • 0

This is what I’m using to allow the enter button to start the search. It works but causes a system beep. I have no idea why.

    private void searchbox_KeyUp(object sender, KeyEventArgs e)
    {
        if (e.KeyCode == Keys.Enter)
        {
            searchbutton.PerformClick();
        }
        else
        {
            //Run.
        }

    }

It happens as soon as I press enter and not some other line in the code. Thoughts on what I’m missing?

Here is searchbutton_Click:

    private void searchbutton_Click(object sender, EventArgs e)
    {
        var searchvar = searchbox.Text;
        SqlParameter var1 = new SqlParameter(@"var1", SqlDbType.Text);
        var1.Value = "%" + searchvar + "%";
        var conn = new SqlConnection("Data Source=TX-MANAGER;Initial Catalog=Contacts;Integrated Security=True");
        var comm = new SqlCommand(@"SELECT [Name ID], First, Last, Address, City, State, ZIP FROM contacts WHERE (First LIKE @var1) OR (Last LIKE @var1)", conn);
        if (checkBox1.Checked == true)
        {
            comm.CommandText += "ORDER BY ZIP";
        }
        else
        {
            //Run.
        }
        try
        {
            comm.Parameters.Add(var1);
            conn.Open();
            comm.CommandType = CommandType.Text;
            SqlDataAdapter da = new SqlDataAdapter(comm);
            DataTable dt = new DataTable();
            da.Fill(dt);
            dataGridView1.DataSource = dt;
            conn.Close();
        }
        catch (Exception e1)
        {
            display_box.Text = e1.ToString();
            tabControl1.Focus();
        }
        finally
        {
            int rowcount = dataGridView1.RowCount - 1;
            count.Text = rowcount.ToString();
            tabControl1.SelectedTab = tabPage2;
        }

    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T22:50:21+00:00Added an answer on June 5, 2026 at 10:50 pm

    You could try adding e.Handled = true; to the KeyPressed event for your TextBox.

    Normally, if your Form doesn’t have its AcceptButton property set, a system beep is played when hitting Enter inside a TextBox. The beep indicates that there’s no default button defined for your Form.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
This works fine, but I want to make it prettier - and accommodate all
This is a normalization thing, but I want I have to hold information about
This should be a simple one: I have an observableArray object called To in
This works. $(document).ready(function(){ $(.items article).click(function(){ window.location=$(this).find(a).attr(href); return false; }); }); However , when the
this is what i have right now Drawing an RSS feed into the php,
This is an example of the code am using. I use a modified version
This question is quite specific. I'm using Symfony2 White October Admin Bundle for generating
I have this code to decode numeric html entities to the UTF8 equivalent character.
This should not be so complicated: I am using Easiest Tooltip and Image Preview

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.