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. Add 3 columns from database to ComboBox

Add 3 columns from database to ComboBox

Scheduled Pinned Locked Moved Visual Basic
databasetutorial
2 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.
  • I Offline
    I Offline
    ivo75
    wrote on last edited by
    #1

    How to Add 3 columns from database to ComboBox, I want to visible 2 of them I use this

    reader = OleDbCommand1.ExecuteReader()
    Dim dt = New System.Data.DataTable()
    dt.Load(reader)
    ComboBox2.DataSource = dt
    ComboBox2.DisplayMember = "column1"
    ComboBox2.ValueMember = "column3"
    ComboBox2.SelectedIndex = -1
    reader.Close()

    this work but can I use this

    ComboBox2.DisplayMember = "column1" + "column2"

    S 1 Reply Last reply
    0
    • I ivo75

      How to Add 3 columns from database to ComboBox, I want to visible 2 of them I use this

      reader = OleDbCommand1.ExecuteReader()
      Dim dt = New System.Data.DataTable()
      dt.Load(reader)
      ComboBox2.DataSource = dt
      ComboBox2.DisplayMember = "column1"
      ComboBox2.ValueMember = "column3"
      ComboBox2.SelectedIndex = -1
      reader.Close()

      this work but can I use this

      ComboBox2.DisplayMember = "column1" + "column2"

      S Offline
      S Offline
      Simon_Whale
      wrote on last edited by
      #2

      in a nutshell you have create a custom class from combobox to do it have a read of this Multiple columns combo box vb.net[^]

      Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch

      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