Tab Control - Pages

ted.martin

Registered User.
Local time
Today, 09:26
Joined
Sep 24, 2004
Messages
743
I have a common text box control which appears on all 4 pages of my tab control. (Common text box control achieved through pasting a text box control onto the tab)

I only want the user to be able to change the data in this text box control if they are on Page 1. If they are on any other Page, then I would like to Lock the text box control.


If there was a Got Focus event for a Page then I could do what I need; but there isn't!


Is there a way to determine which Page of my Tab Control is active?

Many thanks as always.

T
 
Last edited:
The value of the Tab control itself will be equal to the page index of whatever page is currently selected. It's a zero based index, so the first page is PageIndex(0), the second is PageIndex(1), etc. You could do this whith one simple line of code in the Tab controls Chenge event;

Me!MyTextBox.Locked = Me.MyTabControl <> 0

To allow for the possibility that you could rearrange the pages at some point and the one with the unlocked text box may not necessarily be the first tab, then you can do the same but refer to the page name so it will be based on that page no matter where it is in the index;

Dim i As Integer

i = Me!MyTabControl

Me!MyTextBox.Locked = i <> Me!MyTabControl.Pages("MyPage").PageIndex
 
That works a treat. Well done and thank you.
 

Users who are viewing this thread

Back
Top Bottom