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. Set SelectedValue of ComboBox

Set SelectedValue of ComboBox

Scheduled Pinned Locked Moved C#
help
4 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.
  • D Offline
    D Offline
    DIPAK EMSYS
    wrote on last edited by
    #1

    Hi All, I have combobox with name cmbClassId. I have to set the SelectedValue for this combo with the value form the DataTable Cell value. I have done it like below.

    cmbClassId.SelectedValue = (object)dataSet.Tables[Constants.STUDENT].Rows[0]["StudentClassId"];

    but still it is showing me null in SelectedValue property of this combo... please help me out... Thanks & Regards Dipak Thesiya

    dipak

    L C 2 Replies Last reply
    0
    • D DIPAK EMSYS

      Hi All, I have combobox with name cmbClassId. I have to set the SelectedValue for this combo with the value form the DataTable Cell value. I have done it like below.

      cmbClassId.SelectedValue = (object)dataSet.Tables[Constants.STUDENT].Rows[0]["StudentClassId"];

      but still it is showing me null in SelectedValue property of this combo... please help me out... Thanks & Regards Dipak Thesiya

      dipak

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Try with SelectedItem property.It seem's that the property doesn't works fine ^.

      Life is a stage and we are all actors!

      modified on Wednesday, August 19, 2009 6:47 AM

      D 1 Reply Last reply
      0
      • L Lost User

        Try with SelectedItem property.It seem's that the property doesn't works fine ^.

        Life is a stage and we are all actors!

        modified on Wednesday, August 19, 2009 6:47 AM

        D Offline
        D Offline
        DIPAK EMSYS
        wrote on last edited by
        #3

        i am supposed work with SelectedValue Property....

        dipak

        1 Reply Last reply
        0
        • D DIPAK EMSYS

          Hi All, I have combobox with name cmbClassId. I have to set the SelectedValue for this combo with the value form the DataTable Cell value. I have done it like below.

          cmbClassId.SelectedValue = (object)dataSet.Tables[Constants.STUDENT].Rows[0]["StudentClassId"];

          but still it is showing me null in SelectedValue property of this combo... please help me out... Thanks & Regards Dipak Thesiya

          dipak

          C Offline
          C Offline
          Calla
          wrote on last edited by
          #4

          Did you remember to set the ValueMember of the ComboBox?

          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