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 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

Related Questions

I am running some import code asynchronously from a simple WinForms app using a
I have a simple code using ctypes: Python 3.1.1 (r311:74480, Feb 23 2010, 11:06:41)
Here is the super simple code i have: HtmlDocument htmlDoc = new HtmlDocument(); htmlDoc.OptionWriteEmptyNodes
Here's the setup: I'm trying to make a relatively simple Winforms app, a feed
I have written a trivial Entities code-first WinForms application with one simple class and
I've got a simple winform test app i'm using to try some Log4Net Dependency
My WinForms app has a simple modal login form, invoked at startup via ShowDialog().
I need a simple app to edit database tables. Are there any code generators
A lot of a particular C# WinForms app I've seen is code doing simple
The code below shows a small WinForms app which includes a simple Control that

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.