TabPages question

ricio2000

Member
Joined
May 2, 2005
Messages
18
Location
Hialeah, FL
Programming Experience
1-3
I have the following scenario. I wish when somebody enters a form. The user will not be able to click on any tab page. Disable the clicking event on every single tab page except for one until I re-enable it upon them clicking certain buttons. Would this be somthing that will have to be done on every tab click event. That is handle it if the user is in modify mode for instance. They can't go off clicking in any other tab. I could just enable = false the contents of every other tab but I rather the user be unable to go into any other tab for that matter. I'm open to suggestions.Thank you.
 
Last edited:
Hello,

When I consider your question it reminds me of a multi tabbed wizard where you cannot go to the next tab until the previous tab has been filled out. Im sure this is not exactly what you are looking for but Im confident it will give you an idea or two.

The logic of this example will assume that you start on the first tab, and tabs that follow will be enabled as you progress, one at a time.

1. Place a TabControl on the the Form named TabControl1

2. Add to the Pages collection of the TabControl 3 Tab Pages named; TabPage1, TabPage2 and TabPage3.

3. Set the Enabled Property of TabPage1 to TRUE and set the Enabled Property of TabPage2 and TabPage3 to FALSE

4. Append the following line of code to the SelectedIndexChanded event of the TabControl
If TabControl1.SelectedTab.Enabled = False Then TabControl1.SelectedIndex -= 1


Now if you run this application you will notice that only TabPage1 will maintain focus. In order to access the other TabPages you will need to set the Enabled Property to TRUE.


I Hope that helps.

Richard Yager
http://www.systems-exclusive.com
 
Kind of serves my purposes but not quite. I basically don't even want to blind when I change to another tab. Just display a message indicating save or cancel before jumping to another tabpage. Same principle if i try to do that with the keyboard. Now, I'm sure there's a way to do this. I was thinking about setting the selectedTab based on the currently enabled on and if I'm not in edit mode as well. Handle the event some how. I'm going to keep trying, but what a headache. I always try to make the application more complicated than what it is. I should just allow people to be able to switch back and forth.
 

Latest posts

Back
Top