HomeНаука и техникаRelated VideosMore From: SickyNolls

How to create a drop-down menu button in Visual Basic (with just one line of code) - HD

106 ratings | 74585 views
Create a non-toolbar drop-down button in Visual Basic 2008 Express Edition (the free one) using a button, a contextmenustrip and one line of code. An easy way to add professional-style features to your application without any 'mickey-mouse' methods such as using pictures etc.
Html code for embedding videos on your blog
Text Comments (26)
Neptune (1 month ago)
Or you can just use a ComboBox.....
Admin vatebra (8 months ago)
please how can i add a scrollbar
Kutty's Smile (9 months ago)
I have one problem,any one will help me
1uke (1 year ago)
How big does the dropdown arrow have to be?
Travis61805 (2 years ago)
Can the drop down menu lead to a different form?
Hélio Ferreira Cabral (3 years ago)
Very usefull. Thanks
manuel villarroel (3 years ago)
very good from venezuela
PoisonedHive (4 years ago)
why not use a combo box?
Rafy-Ivan Morales (4 years ago)
Hi  This is my fist year in college and my teacher is asking for a project with Visual Basic 2010. the user have to write his Fist name Last Name and in a list box I have to have 5 States. the user have to select the State he or she is form and in a textbox it will show the name last name and the State all in that but I do have problem on how to write the listbox so the user can select the State he is form. I do have problems on how to write the code for this.
SickyNolls (4 years ago)
+Rafy Morales Try the code below. Put it in the listbox event handler for SelectedIndexChanged (get this by double clicking the list box in the forms designer) and the output text box will be updated whenever the selected state is changed. Or put it in a Click event for a button and it will update when that button is pressed. outputTextBox.Text = firstNameTextBox.Text & " " & lastNameTextBox.Text & " comes from " & stateListBox.SelectedItem
Rafy-Ivan Morales (4 years ago)
 I do have the list done my problem is on how to make the code  and how to show this in a textbox with the Fist Name last name and the State
SickyNolls (4 years ago)
Look in the properties pane, there should be something called 'Items' and a button next to it you can press which will open a dialog where you can enter the list of states you want to appear in the list.
Daniel Vasu (4 years ago)
thank you ! :D
Zhar Effendi (5 years ago)
i try and failed, (my VS is close) why?
K. ToTi (5 years ago)
nchauk (5 years ago)
thanks. so simple.
Suhas Athreya (5 years ago)
Thanks a lot, works fine!
buddyroach (5 years ago)
great tutorial. when i change the color of the context menu strip, on the left side of it, its still white. how do i fix this?
Mr22gang (6 years ago)
Thanks! Works Perfect! Liked too :)
Ross Scarlet (6 years ago)
Lejonseld (7 years ago)
thanks very much
SickyNolls (7 years ago)
@SickyNolls (continuation)... perform the search if it does. I've heard about, but not used, some 'dictionary' function that apparently can be used to lookup something with a text string so you may want to research that. If you want detailed help, you will need to provide a more detailed description of the problem.
SickyNolls (7 years ago)
@MsPhilip1999 Are you using a textbox plus contextmenustrip with the items on it or a combobox? If you are using a textbox plus contextmenustrip, you could use: textbox.appendtext(contextmenustrip.text) button.performclick() where textbox is the textbox that you are using for the search terms and button is the name of the search button. For a combobox, you could try using an IF statement to check whether what is in the text area of the combobox matches anything in the list and then...
SickyNolls (7 years ago)
@CyberNetTV Just tried it in vb 2010 and it does work. Make sure that there are items in the contextmenu that you are using otherwise nothing will happen as it is easy to add a contextmenu to your program, put loads of stuff on it, then add a button and a new contextmenu without putting items on it and trying to get it to show.
CyberNetTV (7 years ago)
wow doesn't work -.- i follow exact instructions on vb 2010 from scratch and it doesn't show...
Jonathan (7 years ago)
Thx xD

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.