Is it possible to disable Tabs in TabControl?
-
Hi, I'm building an application which has 3 forms (really large input data required, huh). I have put these 3 forms in a tab control. Now the requirement is, before filling form 1, i cannot move to form 2 & so on. So, can i disable the tab 2 & 3? I don't want to disable all group controls. It would be nice if i can stop the user from going to those tab panes. I can enable tab 2 after clicking button 'Next' which is in tab 1. Same thing i have to repeat for tab 2. obviously, i can use 2 forms by show & hide tactic, but for some reason, it would be nice if i can use Tab control. :) Thanx in advance...
-
Hi, I'm building an application which has 3 forms (really large input data required, huh). I have put these 3 forms in a tab control. Now the requirement is, before filling form 1, i cannot move to form 2 & so on. So, can i disable the tab 2 & 3? I don't want to disable all group controls. It would be nice if i can stop the user from going to those tab panes. I can enable tab 2 after clicking button 'Next' which is in tab 1. Same thing i have to repeat for tab 2. obviously, i can use 2 forms by show & hide tactic, but for some reason, it would be nice if i can use Tab control. :) Thanx in advance...
There is an enabled property, but that kind of defeats the purpose of a tab control, sounds like you want a wizard, really.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Hi, I'm building an application which has 3 forms (really large input data required, huh). I have put these 3 forms in a tab control. Now the requirement is, before filling form 1, i cannot move to form 2 & so on. So, can i disable the tab 2 & 3? I don't want to disable all group controls. It would be nice if i can stop the user from going to those tab panes. I can enable tab 2 after clicking button 'Next' which is in tab 1. Same thing i have to repeat for tab 2. obviously, i can use 2 forms by show & hide tactic, but for some reason, it would be nice if i can use Tab control. :) Thanx in advance...
If you need to stop user going to the second tab before finishing first tab, set a flag variable, and update it when the process finishes in the first tab. When user clicks the second tab, handle the event and check the flag value. If the process is not completed, set the
SelectedIndex
value to select the current tab again. Alternatively, you can disable all the controls in tab page, but user will be able to see that tab. For that use the following codeControl cn = tabPageName as Control;
cn.Enabled = false;Hope it helps
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
-
There is an enabled property, but that kind of defeats the purpose of a tab control, sounds like you want a wizard, really.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
Christian Graus wrote:
There is an enabled property
I was also thinking the same, but tabpages don't have a
Enabled
property. Tab control do have, but it disables the whole control.All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
-
If you need to stop user going to the second tab before finishing first tab, set a flag variable, and update it when the process finishes in the first tab. When user clicks the second tab, handle the event and check the flag value. If the process is not completed, set the
SelectedIndex
value to select the current tab again. Alternatively, you can disable all the controls in tab page, but user will be able to see that tab. For that use the following codeControl cn = tabPageName as Control;
cn.Enabled = false;Hope it helps
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
I'm currently using this 'setting a flag' option. But i thought, there may be some another option for this... so i did asked the question. Thanx for help...
-
There is an enabled property, but that kind of defeats the purpose of a tab control, sounds like you want a wizard, really.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
Christian Graus wrote:
There is an enabled property
There's no Enable property for individual tabs, but it is for whole tab control.
Christian Graus wrote:
sounds like you want a wizard
I don't have any idea about this 'wizard' thing... Ss it available for win app (as it is in web app)? If you mean to say 'wizard' like something, then yes, i want to do somewhat that kind of thing...
-
I'm currently using this 'setting a flag' option. But i thought, there may be some another option for this... so i did asked the question. Thanx for help...
Have you tried my second approach ? As CG said, tab control is not the appropriate control for this scenario. CP having an article on using wizards with winforms. Do a search for that.
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
-
I'm currently using this 'setting a flag' option. But i thought, there may be some another option for this... so i did asked the question. Thanx for help...
My one cent to this. You can group all controls in different tab panels and in individual panel controls. Now you can use your flag to enable or disable the panels.This is the same idea navneeth said but just to ease the number of controls you need to enable or disable. May be you can consider setting the flag to do this in the tab change event.
Thanks Laddie Kindly rate if the answer was helpful
-
Christian Graus wrote:
There is an enabled property
I was also thinking the same, but tabpages don't have a
Enabled
property. Tab control do have, but it disables the whole control.All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
OK - I wasn't sure, I meant to say, 'I think there's an enabled property'. But, I recall I've always had to remove tabs rather than disable them
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Christian Graus wrote:
There is an enabled property
There's no Enable property for individual tabs, but it is for whole tab control.
Christian Graus wrote:
sounds like you want a wizard
I don't have any idea about this 'wizard' thing... Ss it available for win app (as it is in web app)? If you mean to say 'wizard' like something, then yes, i want to do somewhat that kind of thing...
The obvious way to do a wizard, in either a web or windows app, is to create controls that represent the stages of the wizard, and step through which control is visible as you hit next or previous. I believe there's a wizard control built in for web apps, but a wizard for winforms done with controls is pretty easily done. As the controls all exist on the page, they also all hold their state for when you click 'finish'
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )