Just in case you don't already know, you can dynamically add a handler by using code like
yourTabControl.MouseClick += new MouseEventHandler(your_Han
Main Topics
Browse All TopicsI have a C# windows forms dynamically created TabControl with Dynamically created tabpages.
I want that when the user middle clicks the page area in the tabstrip (I hope its clear - when he click the area where the name of the tabPage is shown) to remove this page.
I tried some stuff but I cant figure out what event to use and what exactly it should do.
any help is appriciated.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I'm sorry. That example does seem confusing now that I look at it.
The name of the event handler is arbitrary--you can name your event handler whatever you want as long as you add it to handle the event. The code you should be concerned with is in the snippet. Put that code in your event handler for the TabPage.
Sorry,I can't get it to work. The event does not even fire.
At least not when I click the tip of the tab ( I don't have access the the client area of the TabPage as it is covered by a splitContainer that has other controls inside it - but that should not matter as I am interested in catching the clicks on the tips of the tabPages).
I can get a tabControl1_MouseClick event to fire
but the the handler is the tabControl and I don't know what tabPage was clicked.
Business Accounts
Answer for Membership
by: kaufmedPosted on 2008-12-27 at 17:23:05ID: 23250056
Did you try using the MouseClick event of your control? In the handler you can write code like
If (e.Button == Mousebuttons.Middle)
{
// Your code here
}