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. Windows Forms
  4. combobox and dropdownitems

combobox and dropdownitems

Scheduled Pinned Locked Moved Windows Forms
question
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.
  • C Offline
    C Offline
    CICCIOLO69
    wrote on last edited by
    #1

    Hi, I'm trying to add a sub menu as a combobox filled by a dataset. Adding as main menu item it works, as a submenu not. Here is the code. Dim dsCBO As New DataSet Dim GiacCBO As New ToolStripComboBox Dim strSQL As String = "select item_id,descr from items;" Dim strConn As String = Me.SQLConnString Dim daLookups As New SqlDataAdapter(strSQL, strConn) Try daLookups.Fill(dsCBO) With dsCBO .Tables(0).TableName = "Item" End With Catch excFill As Exception End Try With GiacCBO .ComboBox.DataSource = dsCBO.Tables("Item") .ComboBox.DisplayMember = "descr" .ComboBox.ValueMember = "item_id" End With AddHandler GiacCBO.SelectedIndexChanged, AddressOf GiacCBO_SelectedIndexChanged GiacenzaArticoloToolStripMenuItem.DropDownItems.Add(GiacCBO) The combobox is still empty ?!?! Substituting the last code row with: MenuStrip1.Items.Add(GiacCBO) the GiacCBO object show all records of the dsCBO. What's wrong ?

    N 1 Reply Last reply
    0
    • C CICCIOLO69

      Hi, I'm trying to add a sub menu as a combobox filled by a dataset. Adding as main menu item it works, as a submenu not. Here is the code. Dim dsCBO As New DataSet Dim GiacCBO As New ToolStripComboBox Dim strSQL As String = "select item_id,descr from items;" Dim strConn As String = Me.SQLConnString Dim daLookups As New SqlDataAdapter(strSQL, strConn) Try daLookups.Fill(dsCBO) With dsCBO .Tables(0).TableName = "Item" End With Catch excFill As Exception End Try With GiacCBO .ComboBox.DataSource = dsCBO.Tables("Item") .ComboBox.DisplayMember = "descr" .ComboBox.ValueMember = "item_id" End With AddHandler GiacCBO.SelectedIndexChanged, AddressOf GiacCBO_SelectedIndexChanged GiacenzaArticoloToolStripMenuItem.DropDownItems.Add(GiacCBO) The combobox is still empty ?!?! Substituting the last code row with: MenuStrip1.Items.Add(GiacCBO) the GiacCBO object show all records of the dsCBO. What's wrong ?

      N Offline
      N Offline
      nelsonpaixao
      wrote on last edited by
      #2

      listen, i don´t know if that code is correct, but i think you want to fill combobox with data from table (id_user,user_name). i don´t know vb but that stuff is really simple if you needed in c# code?! did you triggered it (form_load event) so if fill combobox when page loads? :doh:

      nelsonpaixao@yahoo.com.br trying to help & get help

      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