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
im intending to make a brackets checking code that will check some code and look if there's any brackets mistakes in it,
i started like this :
#include<stdio.h> int i=0; ...
I have a form which has in which data is entered in both Textboxes and Checkboxes, when the "Copy" button is clicked all the fields are copied to be pasted ...
How to take the maximum digits file linked with the folder using perl?
my $location = $output_dir; print $location; open LOGFILE, $location; my $first_line = 1; #print $first_line; my $max_id; ...