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. C#
  4. Make 2st item in combo box blank

Make 2st item in combo box blank

Scheduled Pinned Locked Moved C#
tutorial
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.
  • V Offline
    V Offline
    Vernware
    wrote on last edited by
    #1

    I have a combo box that I need to make first item in list blank. Here is the code that loads the combo box: aAdaptor = new OleDbDataAdapter(aSQLQuery, aConnection); aAdaptor.Fill(aDataSet); cBox.DataSource = aDataSet.Tables[0]; cBox.DisplayMember = aDisplayName; cBox.ForeColor = Color.Blue; This code all works great, it loads the combo as I need. But I cannot figure out how to get the first item in the list to be blank. Would appreciate any ideas here. Thanks, Vern Vern

    M G 2 Replies Last reply
    0
    • V Vernware

      I have a combo box that I need to make first item in list blank. Here is the code that loads the combo box: aAdaptor = new OleDbDataAdapter(aSQLQuery, aConnection); aAdaptor.Fill(aDataSet); cBox.DataSource = aDataSet.Tables[0]; cBox.DisplayMember = aDisplayName; cBox.ForeColor = Color.Blue; This code all works great, it loads the combo as I need. But I cannot figure out how to get the first item in the list to be blank. Would appreciate any ideas here. Thanks, Vern Vern

      M Offline
      M Offline
      Mike Dimmick
      wrote on last edited by
      #2

      You'll need to add an empty entry to your dataset. That's the only way I'm aware of.

      Stability. What an interesting concept. -- Chris Maunder

      1 Reply Last reply
      0
      • V Vernware

        I have a combo box that I need to make first item in list blank. Here is the code that loads the combo box: aAdaptor = new OleDbDataAdapter(aSQLQuery, aConnection); aAdaptor.Fill(aDataSet); cBox.DataSource = aDataSet.Tables[0]; cBox.DisplayMember = aDisplayName; cBox.ForeColor = Color.Blue; This code all works great, it loads the combo as I need. But I cannot figure out how to get the first item in the list to be blank. Would appreciate any ideas here. Thanks, Vern Vern

        G Offline
        G Offline
        Guffa
        wrote on last edited by
        #3

        You can insert an item in the DataSet before data binding, or insert an item in the combo box after data binding.

        --- single minded; short sighted; long gone;

        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