Solved

net tab stopping user seeing contents

Posted on 2009-07-01
4
254 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
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…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

752 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