Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello ppl, I need some help.

I have one form that contains emtpy Tab control, also a toolbar button which creates an empty tab and then loads user control into that new tab. On the Usercontrol i have CLOSE button, and I need to close that specific (selected) tab. Can someone help me with this? Thanx in advance.
Posted

1 solution

I believe what you will need is to use a delegate to pass over the event.

Events and Delegates Simplified[^]

Code project article already exists to help with that thanks to Meysam Mahfouzi[^]
 
Share this answer
 
Comments
[no name] 13-Nov-12 7:12am    
Nice One:)
Rob Branaghan 13-Nov-12 7:22am    
Cheers, the articles exist, but sometimes people don't know what to search for :)
Hope this helps them.
Bawg 13-Nov-12 7:28am    
thanx for advice, i was searching a lot before I posted this question. for an ex-vb6 user, this looks like nightmare :) it still does :)

edit : I forgot to say that I just need to fire some event, not to pass any data, I'm not telling which tab need to be closed, just to close currently selected.
Rob Branaghan 13-Nov-12 7:40am    
The reason I suggest using the delegate event, is you set it up so that when the user clicks the close button on the Usercontrol, it will first check to see if the delegate event isnt null, and if it isnt, you can then call the delegate event.
From your form you would then have added that delegate event to call an event on that form which you could then add the Close Selected tab.

Does that make sense?
Its almost as if you are just passing back to the main the fact the event occurred (if you did need to pass data, you could).
Bawg 13-Nov-12 14:56pm    
Thank you all. I'm digging it right now.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900