Results 1 to 2 of 2

Thread: dynamically adding & removing controls

  1. #1

    Thread Starter
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177
    Place a container for each RTF box on each Tab of the SSTab control, i.e. a Picturebox, then use code similar to the following:
    VB Code:
    1. Private Sub Form_Load()
    2.     Dim lCount As Long
    3.    
    4.     For lCount = 0 To 6
    5.         If lCount > 0 Then Load rtfRTFs(lCount)
    6.         With rtfRTFs(lCount)
    7.             Set .Container = picContainers(lCount)
    8.             With picContainers(lCount)
    9.                 .Move 12, SSTab1.TabHeight + 12, SSTab1.Width - 24, SSTab1.Height - SSTab1.TabHeight - 24
    10.                 .BorderStyle = vbBSNone
    11.             End With
    12.             .Move 0, 0, picContainers(lCount).ScaleWidth, picContainers(lCount).ScaleHeight
    13.             .Text = "Tab" & lCount + 1
    14.             .Visible = True
    15.         End With
    16.     Next
    17. End Sub

  2. #2
    Member
    Join Date
    Oct 2001
    Location
    Oklahoma
    Posts
    36
    Thanks Aaron,
    The RichTextBox controls are not to be added all at the same time, but one after the other. Here's the complete scenario:

    I have a MDI application with 5 instances of FORM1 as child forms dynamically loaded at start-up. FORM1 has a Tabstrip control (SSTab1) which holds or contains a richtextbox control. Clicking on a node of a TreeView control on another form should dynalically load a file onto the richtextbox control. Subsequent clicks to the nodes of the TreeView control should load or add new tabs to the SSTab1 control, load new instances of the RichTextBox1 control and load the files unto the active Tab.

    A maximum of 7 Tabs can be added to the SSTab control on any instance of FORM1.

    The user needs to be given an option to open or create a new instance of FORM1 when the maximum number of Tabs on the SStTab control has been reached in the active child form, or close a Tab there in order to add a new one.

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