Solved

net tab stopping user seeing contents

Posted on 2009-07-01
4
250 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
Comment Utility
HI

You should use the Selecting Event that has TabControlCancelEventArgs  
0
 

Author Comment

by:stephenwilde
Comment Utility
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
Comment Utility
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
Comment Utility
Thank you
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
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…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now