CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 1999
    Posts
    2

    trouble with tabstrips....

    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


  2. #2
    Join Date
    May 1999
    Location
    Omika, Japan
    Posts
    729

    Re: trouble with tabstrips....

    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

  3. #3
    Join Date
    Aug 1999
    Location
    Pakistan
    Posts
    366

    Re: trouble with tabstrips....

    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



  4. #4
    Join Date
    Sep 1999
    Posts
    202

    Re: trouble with tabstrips....

    In Form_Load, add line:
    Tabstrip1.Zorder 1


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured