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. Newbie: Programaticaly adding items to a dropdown menu?

Newbie: Programaticaly adding items to a dropdown menu?

Scheduled Pinned Locked Moved C#
questionhelp
7 Posts 4 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.
  • P Offline
    P Offline
    Phillip Hodges
    wrote on last edited by
    #1

    Hello all, I am trying to add several items to a dropdown menu and have hit a brick wall. I have a list of people and I am trying to add a button for each person into the dropdown menu. But I can't get it to work. Any help or ideas? Also how do I add an event to each button so I can get it to do something when I click on it? Thanks in advance, Phil

    "Rules are for the obedience of fools and the guidance of wise men"

    S V T 3 Replies Last reply
    0
    • P Phillip Hodges

      Hello all, I am trying to add several items to a dropdown menu and have hit a brick wall. I have a list of people and I am trying to add a button for each person into the dropdown menu. But I can't get it to work. Any help or ideas? Also how do I add an event to each button so I can get it to do something when I click on it? Thanks in advance, Phil

      "Rules are for the obedience of fools and the guidance of wise men"

      S Offline
      S Offline
      Stefan Troschuetz
      wrote on last edited by
      #2

      Phillip Hodges wrote:

      But I can't get it to work.

      What does that mean? Show the code you've got till now, so we have an idea how far you've come and what still needs to be done or changed.


      "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

      www.troschuetz.de

      1 Reply Last reply
      0
      • P Phillip Hodges

        Hello all, I am trying to add several items to a dropdown menu and have hit a brick wall. I have a list of people and I am trying to add a button for each person into the dropdown menu. But I can't get it to work. Any help or ideas? Also how do I add an event to each button so I can get it to do something when I click on it? Thanks in advance, Phil

        "Rules are for the obedience of fools and the guidance of wise men"

        V Offline
        V Offline
        V 0
        wrote on last edited by
        #3

        mycombo.Items.Add("SomeText"); and just doubleclick the button in your designer. Hope this helps.

        V. Moviereview Archive.

        T 1 Reply Last reply
        0
        • V V 0

          mycombo.Items.Add("SomeText"); and just doubleclick the button in your designer. Hope this helps.

          V. Moviereview Archive.

          T Offline
          T Offline
          t lab
          wrote on last edited by
          #4

          Have a look at Link Buttons. If the list of names is done on the fly add a unique ID to each LinkButton. This should help if i have got the idea of what you are asking LinkButton yourButtonName = new LinkButton(); yourButtonName.Command +=new CommandEventHandler(yourButtonName_Click); private void yourButtonName_Click(object sender, CommandEventArgs e) { } tlab

          V 1 Reply Last reply
          0
          • T t lab

            Have a look at Link Buttons. If the list of names is done on the fly add a unique ID to each LinkButton. This should help if i have got the idea of what you are asking LinkButton yourButtonName = new LinkButton(); yourButtonName.Command +=new CommandEventHandler(yourButtonName_Click); private void yourButtonName_Click(object sender, CommandEventArgs e) { } tlab

            V Offline
            V Offline
            V 0
            wrote on last edited by
            #5

            I think you might want to reply this to Phillip Hodges who is in need of this answer :->.

            V.
            Stop smoking so you can: Enjoy longer the money you save. Moviereview Archive

            T 1 Reply Last reply
            0
            • P Phillip Hodges

              Hello all, I am trying to add several items to a dropdown menu and have hit a brick wall. I have a list of people and I am trying to add a button for each person into the dropdown menu. But I can't get it to work. Any help or ideas? Also how do I add an event to each button so I can get it to do something when I click on it? Thanks in advance, Phil

              "Rules are for the obedience of fools and the guidance of wise men"

              T Offline
              T Offline
              t lab
              wrote on last edited by
              #6

              Have a look at Link Buttons. If the list of names is done on the fly add a unique ID to each LinkButton. This should help if i have got the idea of what you are asking LinkButton yourButtonName = new LinkButton(); yourButtonName.Command +=new CommandEventHandler(yourButtonName_Click); private void yourButtonName_Click(object sender, CommandEventArgs e) { } tlab tlab

              1 Reply Last reply
              0
              • V V 0

                I think you might want to reply this to Phillip Hodges who is in need of this answer :->.

                V.
                Stop smoking so you can: Enjoy longer the money you save. Moviereview Archive

                T Offline
                T Offline
                t lab
                wrote on last edited by
                #7

                Sorry my bad, Is that my brain sleeping? :zzz: I think it is!

                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