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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determining the tab that contains a control

Status
Not open for further replies.

ejgb

Programmer
Oct 24, 2001
41
GB
Using a SSTab control with 4 tabs, each containing a number of additional controls. Is there a way that from the individual controls, I can determine which tab they are sitting on so that I can programmaticly select the correct tab?
 
Will the user be selecting the control from say a drop down list and then the tab will be selected dependant on the selection or have I got totally the wrong end of the stick?

Harleyquinn

---------------------------------
For tsunami relief donations
 
ejgb,

Look at thread222-825221. It contains examples of manipulating with tabs and controls involving Container property.

vladk
 
Harlryquinn,

You are on the right track, the system setup allows the user to dinamically determine which fields require data entry as manditory. Then as part of the update procedure I check to see which fields are manditory, check that the correct data hasa been entered, and if incorrect let the user know.

Finding the controls, and check the data and letting the user know is easy, then what I want is to setfocus to the corresponding control. The problem is that the user could be on any one of the tabs and the checked control might be on another.
 
Hmmm,

I sat for a few hours yesterday having a go at this and as you have that it's not the easiest problem to solve :-(

If vladk's suggestion hasn't been quite what you are after the only thing I could come up with (and it's not the prettiest) would be to hardcode the controls in the code and use a case statement. Something like:
Code:
Select Case strTextRequired 'this being the name of the control requiring input
Case "Text1","Text2"
      sstab1.tab = 0
      'setfocus to the required control here
Case "Text3","Text4"
      sstab1.tab = 1
etc...
As I said this is not the prettiest way to do it but I had real trouble trying to get it to work with .container yesterday.

Hope this helps

PS. I knocked this up on the fly from memory without VB this morning when you replied so the syntax may not be exact

Harleyquinn

---------------------------------
For tsunami relief donations
 
The other hardcode way would be utilizing Tag property... Just read Tag, and it will tell you what sits where.

vladk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top