Solved

net tab stopping user seeing contents

Posted on 2009-07-01
4
252 Views
Last Modified: 2013-12-17
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
0
Comment
Question by:stephenwilde
  • 2
  • 2
4 Comments
 
LVL 19

Expert Comment

by:elimesika
ID: 24754725
HI

You should use the Selecting Event that has TabControlCancelEventArgs  
0
 

Author Comment

by:stephenwilde
ID: 24756493
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
 
LVL 19

Accepted Solution

by:
elimesika earned 500 total points
ID: 24762221
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
 

Author Closing Comment

by:stephenwilde
ID: 31598709
Thank you
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question