...More for the benefit of future readers like me...
Crux of the main question:
"I need to know which page the user uses just before he/she clicks the "Preview" button."
The .Value property of a TabControl is *always* the value of the .PageIndex property of the currently selected page. That's how the control was built.
If your TabControl is called tabTC, then use:
tabTC.Pages(tabTC.Value)
to refer to the currently selected page itself. For instance:
tabTC.Pages(tabTC.Value).Name
would give you the name of the currently selected page itself.
I suspect you wanted to use the OnChange, GotFocus, Click, or other events to set a global variable, so you could check it to find out which page is selected. If so, the above is better and more efficient.
Also by the way, The OnChange event of *THE TABCONTROL* will fire whenever a new page is selected. No need to try to capture stuff that happens to the pages.
And I've noticed the following. There's a TabControl. There's this strip of "tabs" that can be used to select pages. And there's these pages, which are separate from the tabs used to select them. Selecting any of these independently can require a bit of attention, especially since you can click on the form if you click an empty area inside a page's borders (at least in Design View).
Good Luck, All.
-- C Vigil =)
(Before becoming a member, I also signed on several posts as
"JustPassingThru" and "QuickieBoy" -- as in "Giving Quick Answers"
