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. C#
  4. ListBox DataBinding, ValueMember?

ListBox DataBinding, ValueMember?

Scheduled Pinned Locked Moved C#
tutorialquestion
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.
  • S Offline
    S Offline
    STW
    wrote on last edited by
    #1

    (Hello Paresh! I'm sure you will answer...) For simple things, DataBinding is a cool thing; Now I saw that there is a easy property to bind a DataSource with a key in the datatable: list.DataSource=m_workset.Projekte; list.DisplayMember="projekttext"; list.ValueMember="projektid"; Looks good but I didn't find how to get then this Value out of an item - say by double-click on an item. Does anybody knows hot to get this valuemember out of an listboxitem? Thanks! Stefan

    V 1 Reply Last reply
    0
    • S STW

      (Hello Paresh! I'm sure you will answer...) For simple things, DataBinding is a cool thing; Now I saw that there is a easy property to bind a DataSource with a key in the datatable: list.DataSource=m_workset.Projekte; list.DisplayMember="projekttext"; list.ValueMember="projektid"; Looks good but I didn't find how to get then this Value out of an item - say by double-click on an item. Does anybody knows hot to get this valuemember out of an listboxitem? Thanks! Stefan

      V Offline
      V Offline
      VoidMainVoid
      wrote on last edited by
      #2

      I hope this is wath you mean... textBox1.Text = list.SelectedValue; or... textBox1.Text = list.SelectedValue.ToString(); now you have 'list.ValueMember' in textBox1 or any other control or variable you may have, i hope this helps. Signature hmmmmm..... I look for it at home.... tomorrow.

      S 1 Reply Last reply
      0
      • V VoidMainVoid

        I hope this is wath you mean... textBox1.Text = list.SelectedValue; or... textBox1.Text = list.SelectedValue.ToString(); now you have 'list.ValueMember' in textBox1 or any other control or variable you may have, i hope this helps. Signature hmmmmm..... I look for it at home.... tomorrow.

        S Offline
        S Offline
        STW
        wrote on last edited by
        #3

        Thank you. Yes, was what I meant.

        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