Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Combobox List population

Combobox List population

Scheduled Pinned Locked Moved Visual Basic
csharpdatabasevisual-studiohelp
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Carl J Shoup
    wrote on last edited by
    #1

    I have a combobox attached to a database with names in it. How do I get the combolist to show only the name of the text typed as it is type. IE: If I type "A" I want the list to display only the names that start with the letter "A". I was able to do this in the VB6 but lost the function when I upgraded to Visual Studio 2010. Please help!!!!

    cjscs

    J W 2 Replies Last reply
    0
    • C Carl J Shoup

      I have a combobox attached to a database with names in it. How do I get the combolist to show only the name of the text typed as it is type. IE: If I type "A" I want the list to display only the names that start with the letter "A". I was able to do this in the VB6 but lost the function when I upgraded to Visual Studio 2010. Please help!!!!

      cjscs

      J Offline
      J Offline
      Jorgen Andersson
      wrote on last edited by
      #2

      Not to hard to add the functionality. Have a start here[^].

      Light moves faster than sound. That is why some people appear bright, until you hear them speak. List of common misconceptions

      1 Reply Last reply
      0
      • C Carl J Shoup

        I have a combobox attached to a database with names in it. How do I get the combolist to show only the name of the text typed as it is type. IE: If I type "A" I want the list to display only the names that start with the letter "A". I was able to do this in the VB6 but lost the function when I upgraded to Visual Studio 2010. Please help!!!!

        cjscs

        W Offline
        W Offline
        woopsydoozy
        wrote on last edited by
        #3

        The AutoComplete functionality Jorgen links you to is nice. But you might be asking for a simple way to filter your list items (which could be used in conjunction with AutoComplete). Have a look at the BindingSource class and its Filter property. Something like this:

        Dim bs As New BindingSource
        bs.DataSource = dtTable
        Me.ComboBox1.DataSource = bs
        Me.ComboBox1.DisplayMember = "DISPLAY_COLUMN"

        Private Sub ComboBox1\_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles ComboBox1.KeyPress
            bs.Filter = "DISPLAY\_COLUMN LIKE '" & e.KeyChar & "%'"
        End Sub
        
        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups