net tab stopping user seeing contents

Hi

Have windows application c#

Tab - I want on click event of tab - to show warning message if no permission

But in method tab selected it is too late as after messagebox it still goes to tab contents - where do I put code please
Rgds
Stephen
stephenwildeAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
elimesikaConnect With a Mentor Commented:
HI Stephen

You have to implement the Selecting event and use the passed argument to cancel the switching

Something like this ....
private void tabControl_Selecting(object sender,TabControlCancelEventArgs e)
{
 
e.Cancel = !IsAuthorized();
 
}
 
private bool IsAuthorized () {
 
// check authorization and return true/false
}

Open in new window

0
 
elimesikaCommented:
HI

You should use the Selecting Event that has TabControlCancelEventArgs  
0
 
stephenwildeAuthor Commented:
Hi

Thanks for your reply - but could you expain your soution a little bit more please and I cannot find a cancel event

Rgds
stephen
0
 
stephenwildeAuthor Commented:
Thank you
0
All Courses

From novice to tech pro — start learning today.