Solved

show the correct tab

Posted on 2002-04-23
7
181 Views
Last Modified: 2010-05-02
Ho I have 3 tabs. Data is entered in text boxes on each tab then the save button is clicked. the save button is on the form not on any of the tabs. The text boxes are validated. If there is invalid data then focus is set to this textbox and the text highlighted. Now my question is how do I show the correct tab with the invalid text box. ie I am looking at tab3, but the invalid textbox is on tab1. How do I switch to tab1. Is there a way of knowing which tab contains the textbox so that I can include this code in my validation procedure.

I am using VB6 and SSTab
thanks
Merlin007
0
Comment
Question by:merlin007
7 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 6962498
What is you tab control?
Try checking the .Parent and the .Owner properties of the text box, one of them is the form, the other one points to the control the textbox is on.

CHeers
0
 
LVL 2

Expert Comment

by:corvanderlinden
ID: 6962524
One solution is to save the tabnumber your control is on, in the control's Tag

Then use SSTab.Tab=ctl.Tag
0
 

Author Comment

by:merlin007
ID: 6962534
angellll
I tried the .Parent property but this gave me the form. There is no owner property for textbox.

corvanderlinden
Thanks I will try this. At the moment I am using the tag a lot so I will have to parse the string again.

Thanks all

merlin007
0
ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 6962558
Sorry, i wanted to write Container and not owner...

CHeers
0
 
LVL 1

Expert Comment

by:kavithag
ID: 6962574
Your Control right now is on tab(2).

To set the Focus at the text box of Tab(0).Setfocus will set the Focus to 1st tab and then giving text1.setfocus will set it to the required text.
0
 
LVL 3

Accepted Solution

by:
n_narayanan earned 100 total points
ID: 6962605
Follow the steps

1. Place separate frames in all the tabs and place the controls inside the frames.
2. Name the frame as yourframename_0 for first tab's frame
3. like that yourframename_1 for 2nd tab and so on.
4. Suppose you have problem in text2 of 1st tab, but you are not in 1st tab (may be 2nd or 3rd tab).
5. tabcontrolname.tab = right(text2.container.name,1)
6. text2.setfocus

Step 5 and 6 does the actual job.

Cheers

Narayanan

0
 

Author Comment

by:merlin007
ID: 6962652
Thanks everyone
n narayanan has just what I wanted. It saves adding more to the tag property and I had the frames.

Thanks again

Merlin007
0

Featured Post

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question