Questions tagged [contextmenustrip]

ContextMenuStrip should appear when a user right-clicks, reacting to the surroundings. It represents a shortcut menu in C#.

ContextMenuStrip replaces ContextMenu. You can associate a ContextMenuStrip with any control, and a right mouse click automatically displays the shortcut menu. You can show a ContextMenuStrip programmatically by using the Show method. ContextMenuStrip supports cancelable Opening and Closing events to handle dynamic population and multiple-click scenarios. ContextMenuStrip supports images, menu-item check state, text, access keys, shortcuts, and cascading menus.

For more details: http://msdn.microsoft.com/en-us/library/system.windows.forms.contextmenustrip(v=vs.110).aspx

293 questions
0
votes
1 answer

Show an Icon beside an Item in ContextMenuStrip when its clicked

I wrote a windows form application which can change my GateWay automatically by executing two Batch files. Problem is that I want to show "check.ico" icon beside the item in ContextMenu list when I click on it. Here is my code : public Form1() …
Hossain Ehsani
  • 385
  • 2
  • 16
0
votes
1 answer

How can i disable right click menu if there is no item selected in listview

Basicly i have contextmenustrip and listview and i add functions to the context menustrip like delete update etc but i dont want this menu open without click and select any item in listview how can i do it ? #region listview…
0
votes
1 answer

C# TabControl ContextMenuStrip

In a user control of mine I implement a tab control that should programmatically manage tab pages. I connected the tab control with a context menu strip with the menu items "Add", "Edit", "Delete" to respectively add a new tab page, edit or delete…
Alex Konnen
  • 717
  • 6
  • 20
0
votes
1 answer

ContextMenuStrip scrolling up and down arrows information c#

I've been busying myself with the ContextMenuStrip class lately and I've noticed something while trying to add a scrolling option to my CMS. So, the control itels adds automatically those little up and down arrows on the top and the bottom of the…
D. Petrov
  • 1,147
  • 15
  • 27
0
votes
1 answer

Dynamically Created Menu Item with attached code?

I'm reading 2 values from an INI File: The Section Name, & The value of the key named "Path" [Game Name] Path=C:\Game\Game.exe What i'm trying to do is create a Context Menu Item with the caption being the Section "Game Name" and have it launch the…
K0D3R
  • 128
  • 2
  • 10
0
votes
1 answer

HOWTO: Consuming ToolStripMenuItem.DropDownItemClicked in VB.NET

I have a toolStripMenuItem which is a menu containing other dropdown items. When DropDownItemClicked event is raised by selection one of the dropdown items I would like to consume the event if some condition is satisfied, like below: Private Sub…
Willy
  • 9,848
  • 22
  • 141
  • 284
0
votes
1 answer

Avoid toolstripmenu closed on item selected

I have a system tray application on vb.net. This app has a menu with several options. There is an option to select the language app. This language option has three submenus: english, french and spanish. Below is the snipet code of the three…
Willy
  • 9,848
  • 22
  • 141
  • 284
0
votes
2 answers

Catch exception in iteration of ContextMenuStrip items

I'm trying to iterate over contextmenustrip items like this: Public Sub TranslateContextMenuStrip(ByRef u As ContextMenuStrip) For Each t As ToolStripMenuItem In u.Items 'here the error occurs pProcessMenuItem(t) 'not here Next End…
Maiken Roskilde
  • 447
  • 3
  • 14
0
votes
0 answers

ContextMenu on Multiple Buttons to change text of button being right clicked

I have multiple buttons on my VB.net form. I have a single ContextMenuStrip and I have assigned it to all the buttons. I can't seem to figure out how to set the button text to the menu selection based on which button I right clicked on. Any ideas?…
FNDevCJ
  • 137
  • 4
  • 18
0
votes
1 answer

Clear the items after ContextMenuStrip is shown

I wanted to clear the items just after the ContextMenuStrip is shown. However when I was making the following calls, ContextMenuStrip didn't show properly in the first place. Any…
Lys
  • 591
  • 2
  • 9
  • 19
0
votes
1 answer

How to clear Textbox text using contextmenuStrip

I want to know whether there is any way to clear the textbox when I click on contextMenuStrip(1 item named clear). I have 4 textboxes, which i have given same contextMenuStrip name to all textboxes. when running the application, I added some text…
Gopi
  • 236
  • 2
  • 6
  • 20
0
votes
1 answer

Show the ContextMenuStrip on the correct location of ActiveX control

I have an ActiveX control (VB 6.0) that I am using in C# and its right click "e" param has int e.x and int e.y now I want to show the contextmenustrip for this contorl. It is showing but not at the exact location that I right click the mouse, it…
Bohn
  • 26,091
  • 61
  • 167
  • 254
0
votes
1 answer

Interaction between ErrorText and ContextMenuStrip

My application has a datagridview with a RowValidating event handler. If I set ErrorText in RowValidating, it correctly disallows left-clicking on other rows and other controls, but if I have a ContextMenuStrip assigned to another control, the…
Denise Skidmore
  • 2,286
  • 22
  • 51
0
votes
1 answer

Left click not working on notifyicon with contextmenustrip

I have a tray application and I would like to open the ContextMenuStrip if I click on the tray logo. This is my code: private void notifyIcon1_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) …
Silve2611
  • 2,198
  • 2
  • 34
  • 55
0
votes
1 answer

Add context menu strip during runtime in C#

I am trying to add a context menu strip to buttons that are being created during runtime. I am not trying to add new items to a preexisting strip. Visual Studio is giving me an error saying the index is outside of the bounds. Even though the menu is…
AustinWBryan
  • 3,249
  • 3
  • 24
  • 42