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

  • Home
  • SEARCH
  • 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 1013215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:04:01+00:00 2026-05-16T10:04:01+00:00

Simple code C# winform app (visual studio 2010): A simple form with one text

  • 0

Simple code C# winform app (visual studio 2010):

A simple form with one text box here is a keyPress event:

 private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            // The keypressed method uses the KeyChar property to check 
            // whether the ENTER key is pressed. 


            if (e.KeyChar == (char)Keys.Return)
            {
                Process.Start("http://yahoo.com", null);
            }

        }

Works fine if I type in some text in the text box and hit enter, it opens up my default web browser and takes me to a site.

I need to change the text box to autocompletemode = suggestappend and autocompletesource = customsource. And then I fill it like so:

  private void Form1_Load(object sender, EventArgs e)
        {
            AutoCompleteStringCollection s = new AutoCompleteStringCollection();
            s.Add("Jon ");
            s.Add("2 Jon");
            textBox1.AutoCompleteCustomSource = s;
        }

It does the autocomplete as right when I type in a J it comes up with Jon, but now when I hit enter it doesnt fireoff the KeyPress event. It just sits there. I tried putting in a break point and when I type in the first letter J it fires the KeyPress event. Then when i select the string “Jon” from the autocomplete source and then I hit enter the event no longer fires.

Confused :).

  • 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-05-16T10:04:02+00:00Added an answer on May 16, 2026 at 10:04 am

    It would seem the Return key press is being handled because of the auto-complete suggestion drop-down list – you could always use the KeyDown event which still fires in this scenario.

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

Sidebar

Ask A Question

Stats

  • Questions 541k
  • Answers 541k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The immediate problem is that you have: <p class="prf_faves"> <img… May 17, 2026 at 2:49 am
  • Editorial Team
    Editorial Team added an answer Wow, that fits the "a little knowledge could be dangerous"… May 17, 2026 at 2:49 am
  • Editorial Team
    Editorial Team added an answer I suspect you are typing that entire build line you… May 17, 2026 at 2:49 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I've got a simple winform test app i'm using to try some Log4Net Dependency
Whilst playing around with resources in my visual studio 10 project, I came across
I'm trying to pass a business object from one WinForm to another WinForm for
Imagine a winform app, who copy updated assemblies from a source folder A to
I'm doing a simple test of Code Contracts. The following code is in a
I have some simple example WinForms code which I am trying to translate into
I am editing a c# WinForm solution and I do not understand the code
After thinking for long, I have decided to build my data app for the
I'm migrating a WinForms app to WPF. Everything has gone well so far except
I have what seems to be a simple problem that I can't solve myself.

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.