Is there a way to either disable or hide tab pages??

  • Thread starter Thread starter Siv
  • Start date Start date
S

Siv

Hi,
I have a form with a TabControl on it, I have 6 tabs across the top of the
page. What I'd like to do is have all but the first and second tab visible
when the app starts and then as the user completes the data on the first tab
and clicks to the second tab, the third tab appears. What I am trying to
avoid is the user not jumping to the next but one tab as each tab determines
the contents of the one that follows it.

In the properties for the tabpages there are properties like hide and show
but they just don't appear to have any effect when running the app?

Anyone know the answer?
 
As Ken said, the only thing you can do is either Add or Remove the Tabpage(s). You can put code to add the additional
tabpage(s) in the current tab's Click Event( TabControl1.TabPages.Add(Tab1) ) and if you need to remove
tabpages(TabControl1.TabPages.Remove(Tab1) ), you can use a Select Case construct to decide to remove Tabpages. One thing to
watch for is if the user clicks more than one time on the Tabpage in question as it will continue to add TabPages. So, you need
to keep a count and not allow more than those you want to be added or removed.
james
 
Siv said:
I have a form with a TabControl on it, I have 6 tabs across the top of the
page. What I'd like to do is have all but the first and second tab
visible when the app starts and then as the user completes the data on the
first tab and clicks to the second tab, the third tab appears. What I am
trying to avoid is the user not jumping to the next but one tab as each
tab determines the contents of the one that follows it.

<URL:http://dotnetrix.co.uk/tabcontrols.html>
-> "Hide and Show Tabpages in a Tabcontrol."
 
Guys,
Many thanks for your replies and useful links, I can see I am going to have
my work cut out!
One thing I am not sure about (before having read the links you kindly
pointed me to) is the issue that I have designed the contents of the tab
pages in advance, if I remove them and the re-add them can I use the ones
that are already designed, or must I effectively populate them
programmatically.

Could I create a tabcontrol that I don't use on screen and then selectively
copy the pages as needed from this into the one on screen.
I suppose what I am asking is what would be the group's best advice??
 
Siv said:
Guys,
Many thanks for your replies and useful links, I can see I am going to have my work cut out!
One thing I am not sure about (before having read the links you kindly pointed me to) is the issue that I have designed the
contents of the tab pages in advance, if I remove them and the re-add them can I use the ones that are already designed, or
must I effectively populate them programmatically.

Could I create a tabcontrol that I don't use on screen and then selectively copy the pages as needed from this into the one on
screen.
I suppose what I am asking is what would be the group's best advice??

After designing your TabPages, with all the controls on each one ( Buttons, textboxes etc.) in the Form Designer, your Tabpages
will continue to contain all the different controls that you originally put on them
when added or removed. You will not have to recreate them during add/remove. And if you have data, (depending on how you
populate your controls......Textboxes for example) it too should remain until you do something to change it.
james
 
James,
Thanks for this, I have copied the very useful code from the dotnetrix.co.uk
site (http://dotnetrix.co.uk/tabcontrols.html) and modified it to my own
construction and I tried what you said. It does work all my tabs re-appear
with their original controls still on them. Brilliant thanks to you and the
other guys that pitched in.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top