PC Review


Reply
Thread Tools Rate Thread

Disable tab pages

 
 
emferrari@gmail.com
Guest
Posts: n/a
 
      20th Jun 2006
Hi

I have a program with a tabControl which contains 6 tabs. During the
execution of the program I want to Enable/Disable some of the tabs but
I did not find any way to do that. I've tried to use the Hide/Show
methods but without success.

Does anyone have any suggestion on this?

Thanks!

Eduardo

 
Reply With Quote
 
 
 
 
Nicholas Paldino [.NET/C# MVP]
Guest
Posts: n/a
 
      20th Jun 2006
Eduardo,

Did you check the Enabled property on the TabPage class?


--
- Nicholas Paldino [.NET/C# MVP]
- (E-Mail Removed)

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi
>
> I have a program with a tabControl which contains 6 tabs. During the
> execution of the program I want to Enable/Disable some of the tabs but
> I did not find any way to do that. I've tried to use the Hide/Show
> methods but without success.
>
> Does anyone have any suggestion on this?
>
> Thanks!
>
> Eduardo
>



 
Reply With Quote
 
cds_tf_1@hotmail.com
Guest
Posts: n/a
 
      21st Jun 2006
From
<http://msdn2.microsoft.com/en-us/library/system.windows.forms.tabpage.enabled.aspx>:

".NET Framework Class Library
TabPage.Enabled Property
This property supports the .NET Framework infrastructure and is not
intended to be used directly from your code.
This member is not meaningful for this control."

So, the tabcontrol doesn't really support this. There's lots of code on
the web to show you how to override the drawing of your tabcontrol and
disable tabs. In a pinch, it may be enough to handle the "Selecting"
event of the tabcontrol like this:

private void tabControl1_Selecting(object sender,
TabControlCancelEventArgs e) {
try {
if ( ! tabShouldBeEnabled(e.TabPageIndex) )
e.Cancel = true;
} catch (Exception ex) {
_bugSentry.Report(ex);
}
}

> Did you check the Enabled property on the TabPage class?


 
Reply With Quote
 
Galcho[MCSD.NET]
Guest
Posts: n/a
 
      21st Jun 2006
I had to do this and myapproach was to handle
TabControl.SelectedIndexChanged event
in this event I check if user can go on new index tab and if not I
switch them back to last tab and show appropriate message


I hope this helps
Galin Iliev[MCSD.NET]
www.galcho.com

(E-Mail Removed) wrote:
> Hi
>
> I have a program with a tabControl which contains 6 tabs. During the
> execution of the program I want to Enable/Disable some of the tabs but
> I did not find any way to do that. I've tried to use the Hide/Show
> methods but without success.
>
> Does anyone have any suggestion on this?
>
> Thanks!
>
> Eduardo


 
Reply With Quote
 
Bruce Wood
Guest
Posts: n/a
 
      21st Jun 2006
I simply remove the relevant tab pages from the tab control when
they're disabled, and add them back when they're enabled.

The only hassle is that you can only add to the end, so it has to be
the last tab page(s) that is/are done like this.

(E-Mail Removed) wrote:
> Hi
>
> I have a program with a tabControl which contains 6 tabs. During the
> execution of the program I want to Enable/Disable some of the tabs but
> I did not find any way to do that. I've tried to use the Hide/Show
> methods but without success.
>
> Does anyone have any suggestion on this?
>
> Thanks!
>
> Eduardo


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable tab control pages =?Utf-8?B?U3RldmVS?= Microsoft Dot NET Framework Forms 2 13th Sep 2006 11:09 AM
disable reading of asp pages Piz Microsoft ASP .NET 6 16th Nov 2005 02:29 PM
Is there a way to either disable or hide tab pages?? Siv Microsoft VB .NET 6 10th Oct 2005 11:19 PM
Disable Banner Pages jweaver Microsoft Windows 2000 Printing 0 21st Nov 2003 02:32 PM
How do I disable applets on Web pages? Jim Windows XP Internet Explorer 0 21st Sep 2003 08:37 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:13 PM.