Click to See Complete Forum and Search --> : trouble with tabstrips....


Ocool
February 20th, 2000, 06:35 PM
i have a tabstrip with 2 tabs on it. when the form loads, the first 1 is defautled selected. the first one shows up fine, but when i click on the second one,nothing shows up, so i click on the first one again, it shows up again. how can i solve this problem? heres my code, id GREATLY APPRECIATE it if anyone could help me on this asap!!! thanks!!


i have 2 picture boxes that are in the tabstrip. the first one to be show is visible = true, the second one is visible = false


private Sub TabStrip_Click()
Dim i as Integer
'show and enable the selected tab's controls
'and hide and disable all others
for i = 0 to TabStrip.Tabs.Count - 1
If i = TabStrip.SelectedItem.Index - 1 then
picBox(i).Visible = false
picBox(i).Visible = true
else
picBox(i).Visible = true
picBox(i).Visible = false
End If
next
End Sub




Thanks!!!
_______
Aaron

Ravi Kiran
February 20th, 2000, 08:02 PM
Answer these questions, and the info should indicate where the problem is?

1. Are the positions of the PictureBoxes currect?
Typically on Form load or Resize, one would set the positions of the pictureboxes to same point. so that later on switching can be done by just making one or the other visible.

2. By any chance the Parent for Picturebox 2 is Picturebox 1?
If the PB2's Container is PB1 then making PB1.Visible=False, would automatically make PB2 also invisible.
It could happen, by overlook. Because in the design view when you created the second PB, you could have started drawing it from some point which happend to be inside the PB1. Soln for this problem is (I)select PB2 and cut using Cntrl+x. (All other controls inside it would also be cut & copied to ClipBoard). Then (2) Set the focus to main form by cliking on the border or somewhere and (3) paste using cntrl+V. This will make the parent/Container for PB2 as Main/base form.

Trick to find out if PB2's container is PB1, in design view: Select PB2 and move it to some point outside pb1. If some portion of it becomes invisible in that process, then yes. else no.


3. You could still use Zorder, although it is not necessary with .Visile = False type of code.

4. PB are resouce Hungry. Use Frame controls instead, unless you have some paiting to be done.

5. You could also put some Debug statements: About positions, and container names
Debug.print picbox(i).Container.Name


RK

chem1
February 20th, 2000, 09:36 PM
Try using MS Tabbed Dialog Control.Set its Style property to SSProperty Page.It is a far better control than then TabSTrip control u r using;
hope this helps

Bruno
February 20th, 2000, 11:31 PM
In Form_Load, add line:
Tabstrip1.Zorder 1