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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:59:20+00:00 2026-06-16T00:59:20+00:00

I’m working on VS 2010 with VB using .NET Framework 4.0 I have a

  • 0

I’m working on VS 2010 with VB using .NET Framework 4.0

I have a combobox. It has some items in it and displays just fine. Here’s where it gets a little weird:

If I click the drop-down arrow on the combobox and CLICK on the item I want, SelectedIndexChanged is called – good.

If I click inside the text area of the combobox and start typing what I want selected and finish it by pressing the up (or down) key, SelectedIndexChanged is called – also good.

If I click the drop-down arrow on the combobox and start typing what I want selected and finish it by pressing ENTER, SelectedIndexChanged is not called – PROBLEM.

Is there a different event that is caused by the ENTER in the last case? I’ve tried using the TextChanged and TextUpdate events, but those do not seem to be working:

Private Sub cmbStatus_TextChanged(sender As System.Object, e As System.EventArgs) Handles cmbStatus.TextChanged
If e.Equals(Keys.Enter) Then
    Call SomeMethod()
End If

Should I use something besides e.Equals(Keys.Enter)?

Is there another event I should be looking for?

EDIT:
An example of the items in the ComboBox are:

  • 10 – NEW ENTRY AND COMPLETENESS CHECK ---> this is the most common type
  • 13 – ASSIGNED TO TRB/HRB ---> there are a few with '/'
  • 60 – EXTERNAL (HOLD UNTIL FURTHER NOTICE) ---> there are a few with '(' and ')'

Basically, the type of each listing is “## – SOME TEXT”.

  • 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-16T00:59:21+00:00Added an answer on June 16, 2026 at 12:59 am
    Option Strict On
    Public Class Form1
        Friend WithEvents ComboBox1 As New ComboBox With {.Parent = Me}
        Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
            ComboBox1.Items.AddRange({"hello", "tes1ted", "word", "item", "tes2ted"})
            ComboBox1.Text = ComboBox1.Items(0).ToString
        End Sub
        Private Sub ComboBox1_KeyUp(ByVal sender As Object, ByVal e As KeyEventArgs) Handles ComboBox1.KeyUp
            'You can put this in the keydown event, or adapt it a small bit and put it in the keypress event
            'putting it in the textchanged event is problematic and not recommended.
            Dim OriginalText As String = ComboBox1.Text
            If e.KeyCode = Keys.Enter Then
                If ComboBox1.SelectionLength > 0 Then
                    ComboBox1.Text = ComboBox1.Text
                    ComboBox1.SelectionLength = 0
                    ComboBox1.SelectionStart = ComboBox1.Text.Length
                End If
            End If
            If Not IsTextKey(e.KeyCode) Then Exit Sub
            Dim Filter As String = ComboBox1.Text & "*"
            If Filter.Length = 1 Then Exit Sub
            For I = 0 To ComboBox1.Items.Count - 1
                If LCase(ComboBox1.Items(I).ToString) Like LCase(Filter) Then
                    ComboBox1.SelectedItem = ComboBox1.Items(I)
                    ComboBox1.Select(OriginalText.Length, (ComboBox1.Text.Length - OriginalText.Length))
                    Exit Sub
                End If
            Next
        End Sub
        Function IsTextKey(ByVal Key As Integer) As Boolean
            Select Case True
                Case Key = Keys.Up : Return False
                Case Key = Keys.Down : Return False
                Case Key = Keys.Left : Return False
                Case Key = Keys.Right : Return False
                Case Key = Keys.Back : Return False
                Case Key = Keys.Delete : Return False
                Case Key = Keys.LWin : Return False
                Case Key = Keys.RWin : Return False
                    'add whatever I missed
                    'return false if the key either removes text from the textbox 
                    'or does not produce a character
                Case Else
                    'return true if the key produces a visible character(including space)
                    Return True
            End Select
        End Function
    End Class
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have an array which has BIG numbers and small numbers in it. I
I have thousands of HTML files to process using Groovy/Java and I need to
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text

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.