rreeves rreeves - 5 months ago 69
C# Question

Remove tab from tabpages from current tab

I have a tabcontrol from my mainform that I add user controls too. I want to be able to remove the tab from the collection from within itself. Maybe put a little x on the corner. How do you think I would go about doing that ?

This is how I add stuff to the TabPage control.

DevExpress.XtraTab.XtraTabPage tabPage = new DevExpress.XtraTab.XtraTabPage() { Text = room.Name, Tag = roomView };

roomView.ParentTab = tabPage;
roomView.Dock = DockStyle.Fill;
roomView.Settings = Settings;



Put the "x" button out there, assign an event to it, then in the click event call something like this:


Something like that should work.