blog

Home / DeveloperSection / Blogs / How to create Right Click Menu on C# windows form in Visual Studio 2012

How to create Right Click Menu on C# windows form in Visual Studio 2012

Vilas Shende7649 18-Aug-2013

In this blog, I am trying to explain "How to create right click menu on C# form of Visual Studio 2012".



Step 1: Open Visual Studio 2012

























Step 2: Click on "New Project"




After clicking on "New Project" you will get screen like given below:-



Step 3: Select "Visual C#" from Project Type & "Windows Form Application" from Project Templates. 








Step 4: Drag and drop the ContextStripMenu from toolbox.


Step 5: Then Right click on Form1 and select the ContextStripMenu property and select your ContextStripMenu which drag and drop on editor.


Step 6: Click on the contextMenuStrip1 to show on the form.


Step 7: Double click on the refresh and exit to get it events.


Step 8: Write the this.Refresh() in refresh sub menu event below is example:
private void showToolStripMenuItem_Click(object sender, EventArgs e){      this.Refresh();}


Step 9: Write the this.Close() in Exit sub menu event below is example:
private void exitToolStripMenuItem_Click(object sender, EventArgs e){      this.Close();}       



Your coding has been done now, Just press F5 to run your code or Go to Menu Bar > Debug > Start Debugging. You will get current time. THANK YOU. 


Updated 18-Sep-2014
I am a Junior Level Programmer, Software Developer as well as Experienced Virtual Assistant who supports to businesses & individuals with achieving their professional goals.

Leave Comment

Comments

Liked By