Results 1 to 9 of 9

Thread: [RESOLVED] SSTAB - Dynamic loading of controls onto tabs

  1. #1

    Thread Starter
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Resolved [RESOLVED] SSTAB - Dynamic loading of controls onto tabs

    I can't get the Rich Text Box to load on the second tab. It always loads on the first tab. How can I get dynamic created controls to load on the tabs other than the first one?
    Code:
        Dim RichTextBox1 As Object
    
    
        Set RichTextBox1 = Me.Controls.Add("RichText.RichTextCtrl.1", "RichTextBox1")
        SSTab.Tabs=2
        SSTab1.Tab=1
        Set RichTextBox1.Container = SSTab1
        RichTextBox1.Visible = True

  2. #2
    Addicted Member
    Join Date
    Jul 2002
    Location
    UK
    Posts
    147

    Re: SSTAB - Dynamic loading of controls onto tabs

    i think you need to select the tab before loading the textbox:

    Code:
        Dim RichTextBox1 As Object
    
        SSTab.Tabs=2
        SSTab1.Tab=1
        Set RichTextBox1 = Me.Controls.Add("RichText.RichTextCtrl.1", "RichTextBox1")
        RichTextBox1.Visible = True
    Mik706

  3. #3
    Lively Member
    Join Date
    Feb 2007
    Posts
    83

    Re: SSTAB - Dynamic loading of controls onto tabs

    id rather use tabstrip instead of sstab

  4. #4
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: SSTAB - Dynamic loading of controls onto tabs

    Randem, I see nothing wrong with the code you posted and it works fine for me. The problem is elsewhere.

    Are you changing the Left property anywhere in your code? As with adding controls at runtime, the Tab with the control must be the current Tab when setting a control's Left property.

  5. #5

    Thread Starter
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: SSTAB - Dynamic loading of controls onto tabs

    mik706,

    You didn't read the code... The tab is set.

    brucevde,

    How could it work? Do you see the RTF box on the second tab?

  6. #6

    Thread Starter
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: SSTAB - Dynamic loading of controls onto tabs

    Here is the code I have been playing with
    Attached Files Attached Files

  7. #7
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: SSTAB - Dynamic loading of controls onto tabs

    This is one of those quirky problems with the SSTab. Within Form_Load, you cannot add controls at runtime onto a Tab other than Tab 0.

  8. #8

    Thread Starter
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: SSTAB - Dynamic loading of controls onto tabs

    Thanks brucevde. That cleared up that mystery... It works when I move the routine out of the Form_Load Event. Strange....

  9. #9
    New Member
    Join Date
    Sep 2007
    Posts
    1

    Re: [RESOLVED] SSTAB - Dynamic loading of controls onto tabs

    This really helped me you. I spent hours trying to figure out why my SSTab was not working properly (on startup.) My workaround was adding a timer that loaded the controls, then disabled itself.

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