If frm.Caption = Button.ToolTipText Then frm.WindowState = 2 Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button) What could i do, in VB6 the code works, it looks like this: I could use your code, but i've written that i make MDI, so i have open and delete windows and so i (don't) need so much Items in my MenuBar. Or the relevant menu item that was clicked.the above code does not work because the sender of the menustrip item clicked event is always the menustrip not the menu item. ToolStripItemClickedEventArgs ) Handles MenuStrip1. Private Sub MenuStrip1_ItemClicked ( ByVal sender As System. Your code doesn't works, i don't know why.Įach item of as menustrip has its own click event.why not use the individual click event: Yes, i want this, i want to know which item i clicked on. The sender of the MenuStrip item clicked event is always the menustrip no matter the item clicked Private Sub ToolStripMenuItem1_Click ( ByVal sender As System. If you are looking for which "item" was clicked you need to use the individual item clicked event The big and italic written "ITEM" is now my problem. If ChildForm.WindowID = ITEM.ToolTipText ThenĬhildForm.WindowState = FormWindowState.Maximized Private Sub MenuStrip1_ItemClicked( ByVal sender As System.Object, ByVal e As ) Handles MenuStrip1.ItemClickedįor Each ChildForm As Form1 In Me. Now i want to maximize the Form, when i click on the Item in the MenuStrip, so i have this script: So, the Item in the MenuStrip gets the ID from the Window as ToolTipText. This string is setted, when i click on the "New-Window-Button". I create a new Form and a new Item in the MenuStrip, (tabbed mdi) so, the form has an public string ID="Window1", "Window2", "Window3". No, that couldn’t be the right for my problem. The first object that is passed in to the click event ('sender') will be the menu item that was clicked. If you're adding the items in code, then you'll also have to add the handling procedure manually, something like:Īddhandler Menustrip1.Items(1).Click, AddressOf M圜lickProcedure I want from the clicked Item the ToolTipText. Yes, but how call i the items, that i've created with Each menu item has it's own Click event just double-click the menu item in the designer and it will add the click handler procedure into your code for you. I'm not sure I understand what you're asking. I’ve tested it with MenuStrip1.ClickedItem but that doesn’t works. With wich variable can i access the clicked item in a MenuStrip Posted: Visual Basic Language, How to access the clicked item? Index ‹ Visual Basic ‹ Visual Basic Language
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |