473,385 Members | 1,351 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Disable tab pages

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

Jun 20 '06 #1
4 9299
Eduardo,

Did you check the Enabled property on the TabPage class?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<em*******@gmail.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
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

Jun 20 '06 #2
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?


Jun 21 '06 #3
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

em*******@gmail.com 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


Jun 21 '06 #4
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.

em*******@gmail.com 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


Jun 21 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: AmigaLemming | last post by:
As I understand my admins installed a PHP server and now my plain HTML pages also want to set a PHPSESSID cookie when loaded into a browser. Can I suppress this, e.g. by creating a configuration...
21
by: Tony Marston | last post by:
If the use of the browser's BACK button is interfering with the operation of your web application then take a look at this article entitle "Back Button Blues" ...
4
by: Phil | last post by:
Hello all, Can anybody give me any ideas on how to disable a tab page within a tab control. I have a tab control tabClients with 3 pages. I would like to disable pages 2 & 3 when a certain...
6
by: Raghu Raman | last post by:
Hi, we are doing an in house project in c#.net(asp.net).We wanted to close our application when ever the user presses the SIGNOUT button. Even though we programtically disconnects them from the...
1
by: Bob | last post by:
Does anyone know how to disable javascript in the new Netscape 8 -- for off line testing (like can be done readily with the current MSIE, Firefox or Opera browsers) ? When I try tools -> options...
7
by: Chris Hayes | last post by:
Hello All, I have grown very annoyed with the ASP.NET Development Server since I still develop with a full instance of IIS and would like to know is there a nice clean way to disable the ASP.NET...
2
by: ad | last post by:
I use authorization to Form in the root Web.config But now I want to disable the Form authentication when request some web pages How can I do?
56
by: Deepan HTML | last post by:
Hi All, Currently i am working in a framed environment where i have divided the window as 20% and 80% and the 20% is used for navigation purpose and right frame for displaying the orignal content....
4
by: =?Utf-8?B?TUNN?= | last post by:
I am trying to disable ViewState at the application level. I have the following line in my web.config: <pages enableViewState="false"></pages> But it is not working. What can I do?
8
by: alamodgal | last post by:
hiiiiiiiiiii everybody, pls solve my problem if u can? Actualy what happens in my site when i press enter key it will show some secured...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.