Newbie: Programaticaly adding items to a dropdown menu?
-
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"
-
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"
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
-
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"
mycombo.Items.Add("SomeText");
and just doubleclick the button in your designer. Hope this helps. -
mycombo.Items.Add("SomeText");
and just doubleclick the button in your designer. Hope this helps.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
-
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
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 -
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"
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
-
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