Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

show the correct tab

Posted on 2002-04-23
7
Medium Priority
?
187 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 143

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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 143

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 400 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

783 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