i have a tool strip button for bookmarks like the one in Mozilla fire fox or google chrome, i can add button and i can click it but i cant remove it , because that i added context menu to the tool strip with remove, so i want the code for removing the selected tool strip button .
The following code (courtesy of: this post) will hopefully help.
First, add a class level variable to store the button that was clicked (i.e. the one to be removed from the tool strip.
Dim clickedButton As ToolStripItem = Nothing
Then add the following code to the Opening event of your context menu. This code attempts to identify the button that was clicked when the prior to the context menu being displayed:
Private Sub ContextMenuStrip1_Opening(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles ContextMenuStrip1.Opening Dim strip As ToolStrip = TryCast(ContextMenuStrip1.SourceControl, ToolStrip) clickedButton = Nothing If strip IsNot Nothing Then Dim position As Point = strip.PointToClient(MousePosition) For Each item As ToolStripItem In strip.Items If item.Bounds.Contains(position) Then clickedButton = item Next End If End Sub
Finally, in your remove menu item, add the following code to remove the actual button:
Private Sub RemoveToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles RemoveToolStripMenuItem.Click If clickedButton IsNot Nothing Then ToolStrip1.Items.Remove(clickedButton) End Sub
thank you very much you don't know how much you helped me
There are a number of very old threads on CUDA so I'm starting a new one rather than resurrecting an old one.
Does anyone here have any experience setting up ...
ive been develop a project known as ordering system
i need to delete data from db by clicking the button
ive follow a tutorial from utube and to the exact ...
APLX is a very complete implementation of the APL programming language from MicroAPL. The company stopped producing it in 2016 and it has been taken over by Dyalog. While Dyalog ...