Sunday, 15 July 2012

vb.net - Extract text from clicked submenu item of Menustrip -



vb.net - Extract text from clicked submenu item of Menustrip -

i've been dealing , looking way of extracting text of given subitem when clicked , write text in textbox1.

this code have far, not seem work.

private sub menustrip1_itemclicked(byval sender system.object, byval e system.windows.forms.toolstripitemclickedeventargs) handles menustrip1.itemclicked dim result string if accionatoolstripmenuitem.checked = true result = accionatoolstripmenuitem.text textbox1.text = result end if end sub

you using wrong event. itemclicked event works items on menu. need add together event each of subitems:

sub sometoolstripmenuitem_click(sender object, e eventargs) handles sometsmenuitem.click textbox1.text = ctype(sender, toolstripmenuitem).text end sub

you can create function each subitem or handle every event on same function:

handles item1.click, item2.click, item3.click

vb.net menustrip subitem

No comments:

Post a Comment