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. Really simple question on Drop Down List Boxes

Really simple question on Drop Down List Boxes

Scheduled Pinned Locked Moved C#
questionhelp
4 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
    Infernojericho
    wrote on last edited by
    #1

    Just a quick question...Have been trying to figure this out for the past 30 minutes but with no luck. Figured I'll just post in here for help. How exactly do you get the contents of the item selected in the Drop Down List? Here's the code: lblResult.Text = ddlBackgroundColor.SelectedItem.Text; However I am getting a blank lblResult everytime. I am just baffled where did I miss. Grrr.... Anyway advice is greatly appreciated. Thank you.

    S 1 Reply Last reply
    0
    • I Infernojericho

      Just a quick question...Have been trying to figure this out for the past 30 minutes but with no luck. Figured I'll just post in here for help. How exactly do you get the contents of the item selected in the Drop Down List? Here's the code: lblResult.Text = ddlBackgroundColor.SelectedItem.Text; However I am getting a blank lblResult everytime. I am just baffled where did I miss. Grrr.... Anyway advice is greatly appreciated. Thank you.

      S Offline
      S Offline
      Sandeep Akhare
      wrote on last edited by
      #2

      Where are you populating the Drop downlist ? the items are static one or dynamically you are adding ? try to debug the application

      Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

      I 1 Reply Last reply
      0
      • S Sandeep Akhare

        Where are you populating the Drop downlist ? the items are static one or dynamically you are adding ? try to debug the application

        Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

        I Offline
        I Offline
        Infernojericho
        wrote on last edited by
        #3

        Hi, thanks for the reply. I am not sure what does populating mean, but all I did was open a form, dragged the Drop Down List, Button, and Label to the form. I added a few items to the DDL, via the "items" properties. They were all hard coded beforehand, so I would assume they are static. I am just trying to get the label to show what was chosen by the click of the button. Thanks

        S 1 Reply Last reply
        0
        • I Infernojericho

          Hi, thanks for the reply. I am not sure what does populating mean, but all I did was open a form, dragged the Drop Down List, Button, and Label to the form. I added a few items to the DDL, via the "items" properties. They were all hard coded beforehand, so I would assume they are static. I am just trying to get the label to show what was chosen by the click of the button. Thanks

          S Offline
          S Offline
          Sandeep Akhare
          wrote on last edited by
          #4

          ok try to debug(F5) your application by putting debug point where you have written the code ...... and see dropdown list contains all the values Assuming that you know how to debug and the code that you have written is in button click event

          Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

          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