Solved

show the correct tab

Posted on 2002-04-23
7
183 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: 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 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

Independent Software Vendors: 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!

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

738 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