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


C# C# 
Ratings:
3 Comment(s)
 3590  View(s)
Rate this:

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. 


Edit in last two line

By Vilas Shende on   3 years ago
Dear readers, please ignore that last two lines, Actually these lines copied from my one another blog.
You will not get current time on form, after run your application, Right click on form you will get menus in right click.
Thanks.
Warm request to:- Team Mindstick.com. Can i edit this blogs last line? i did not found any option for the same on your website.

Edit in last two line

By John Smith on   3 years ago
Vilas , Please send request from Contact Us page you can also send an Email from your email to info@mindstick.com.
MindStick Team will review your request and will send you link to your email ID to modify Blog.

Thanks,
John

Do not post same content on Article and Blog Section

By John Smith on   3 years ago
You have also uploaded same Blog to Article Section. Please do not post same content on Article and Blog section.

Don't want to miss updates? Please click the below button!

Follow MindStick