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 7585287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:08:23+00:00 2026-05-30T19:08:23+00:00

I am building a kind of autocomplete text input using a WinForms ComboBox ,

  • 0

I am building a kind of autocomplete text input using a WinForms ComboBox, and I need the autocompletion behavior to change depending on the position of the caret in the string.

However, the ComboBox doesn’t seem to expose an event to catch a change in the caret position. I can catch TextUpdated when the user is typing. But when the user is navigating, I need to handle KeyDown and check if the KeyCode is Left, Right, Home or End. However the event is fired before the caret is changed, so I would need to compute the new caret position. This is extremely annoying because this requires special handling when Ctrl is pressed and possibly if there are some special accessibility settings I don’t know about.

So I was wondering if there was a better way to do that. Is there an event that is fired each time the caret changes position in the ComboBox or is there a way I can execute code after the KeyDown event is handled by the ComboBox?

  • 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-30T19:08:24+00:00Added an answer on May 30, 2026 at 7:08 pm

    You can execute the code right after KeyDown processing:

      private void comboBox1_KeyDown(object sender, KeyEventArgs e)
      {
           BeginInvoke(new MethodInvoker(_CheckCaretPosition));
      }
    
      void _CheckCaretPosition()
      {
           int caretPosition = comboBox1.SelectionStart;
           Debug.WriteLine(caretPosition);
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For building a unix/dos specific script I need to know on which kind of
I am building such kind of ul using class TagBuilder var ulTag = new
I'm building a kind of a forum, so I need to display posts. Each
I'm building a website that will be an open-source, user-contributed content kind of thing,
building a site using PHP and MySQL that needs to store a lot of
I'm building some kind of proxy. When I call some url in a rack
I am looking for some kind of solution of building some kind of desktop
We are building a simple CMS with asp.net 3.5 and mssql2005 We need to
I'm building an application that is a kind of registry. Think about the dictionary:
I am building several forms dynamically on a page (Kind of like news feeds

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.