Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

On Activate Tab problem 1

Status
Not open for further replies.

spgreen

Programmer
Aug 16, 2004
21
GB
All,

I have this problem with my tabbed control i want to process some information when specified tab is selected but nothing happens until you actually click the on a area inside the tabs page. This in itself is a problem as I have a lot of frames on the tab so actually clicking on the tab area is difficult. I want the information to load up as soon as the user clicks on the tab at the top of the screen. I've tried the on_click, activate and gotfocus functions but none of them are supported. Anybody have a solution to this

Simon
 
How about using the OnChange event and test .value property of tabcontrol to tell you which tab was clicked?

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
The first step is to identify which tab in the tab control has been clicked. Here is some example code, which assumes your tab control is called MyTabCtrl:

Code:
Private Sub MyTabCtrl_Change()
    MsgBox MyTabCtrl.Value
    MsgBox MyTabCtrl.Pages(MyTabCtrl.Value).Name
End Sub

-- Notice that this code is placed in the tab control's On Change event.
-- The Value property returns the position of the tab, reading from left to right, with the left-most tab numbered '0'
-- The Pages(Index).Value returns the name (text on the tab) of the tab which is at the position indicated by 'Index'.
-- Thus you use 'Value' to get the index number, then use this in Pages(x).Value to get the text from the tab.

I think you can now use this to write the code you require - place your code in the tab control's On Change Event (not an event associated with in individual tab), and use 'Value' - for example, in a Select Case statement - to decide what code to execute for each tab.





Bob Stubbs
 
thanks guys exactly what i was looking for just i was looking under the individual tab instead of the group tab. thanks for the pointer

Simon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top