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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. How do I Empty a ComboBox after set DataSource

How do I Empty a ComboBox after set DataSource

Scheduled Pinned Locked Moved Visual Basic
databasecsharpperformancehelp
3 Posts 2 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.
  • K Offline
    K Offline
    Kerry Drake
    wrote on last edited by
    #1

    I am working on a project trying to get my DB and VB.NET skills up to speed. I have established a connection to my database and linked a combobox to the database thusly:

    ComboBox1.DataSource = techDataSet.Tables("tblEmployee")
    ComboBox1.DisplayMember = "EmployeeName"

    However this puts the first record into the "textbox" portion of the ComboBox. I would prefer the ComboBox "textbox" portion to be empty and all the database information be in the dropdown... Any help would be appreciated.

    My goal in life is to be the kind of person my dog thinks I am.

    C 1 Reply Last reply
    0
    • K Kerry Drake

      I am working on a project trying to get my DB and VB.NET skills up to speed. I have established a connection to my database and linked a combobox to the database thusly:

      ComboBox1.DataSource = techDataSet.Tables("tblEmployee")
      ComboBox1.DisplayMember = "EmployeeName"

      However this puts the first record into the "textbox" portion of the ComboBox. I would prefer the ComboBox "textbox" portion to be empty and all the database information be in the dropdown... Any help would be appreciated.

      My goal in life is to be the kind of person my dog thinks I am.

      C Offline
      C Offline
      ctwalker
      wrote on last edited by
      #2

      All you need to do is set the SelectedIndex of the ComboBox = -1. That will take care of it.

      K 1 Reply Last reply
      0
      • C ctwalker

        All you need to do is set the SelectedIndex of the ComboBox = -1. That will take care of it.

        K Offline
        K Offline
        Kerry Drake
        wrote on last edited by
        #3

        Excellent,thanks.

        My goal in life is to be the kind of person my dog thinks I am.

        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