This may seam like a dum question: im trying to learn vb.net and i dont know how to do menus it used to be select case index,case 1 etc

im trying to learn vb.net and cant seam to understand how a menu works


it used to be select index
case 1' text
'do work for textselected menu option
case 2 'excel
'do work for excel selected menu option
end select

i dont understand how to do it now..(man its hard for a basic coder to understand all this jumbo)it like learning chinnese(no offence)

dang really confuzzled
Johnny
aka Pern
JohnnyAsked:
Who is Participating?
 
iboutchkineConnect With a Mentor Commented:
Add menu and write your code under menu click event

    Private Sub Mymenu_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Mymenu.Click

        TextBox1.Text = "Menu is clicked"

    End Sub
0
 
JohnnyAuthor Commented:
what about multi tiered menus like


tools
.. inport
.. export
....text
....excel

i dont understand how to get the area for text and excel as its a submenu of export and tools

??????
thx
0
 
iboutchkineCommented:
Add menu to the form and you will see how to do menu and submenu
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
tzxie2000Connect With a Mentor Commented:
put a mainmenu or contextmenu on the form
add menuitem to it
double-click the item and then you can write code like

 Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
......
    End Sub

VB.Net set each menuitem as an component(object) and the mainmenu as container
so we can write event for menuitem
the full action is doing by event process know as button click event
0
 
Éric MoreauConnect With a Mentor Senior .Net ConsultantCommented:
Each menuitem has its own Click event (unless you handle them all with the same method). You can add code to each menu item click event.
0
 
JohnnyAuthor Commented:
emoreau explaned it best,

tzxie2000 gave insight

and iboutchkine i didnt understand till others piped in but had answered the question

thanks i didnt make a menu past one item so i never saw the way it made them.

0
All Courses

From novice to tech pro — start learning today.