Results 1 to 5 of 5

Thread: Assign RichTextBox to Tabcontrol

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2004
    Posts
    2

    Assign RichTextBox to Tabcontrol

    How do I get my newly created richtextbox inside my newly created tab?

    The tab and richtextbox creator works fine, but how do I get it work. Right now it's just putting the RichTextBox behind the tab.

    Code:
     
        Function NTab()
            Dim myTabPage As New TabPage
            myTabPage.Text = "Untitled" & (TabControl1.TabPages.Count + 1)
            TabControl1.TabPages.Add(myTabPage)
            Dim ControlCount As Integer
            Dim MyTextBox As RichTextBox
            MyTextBox = New RichTextBox
            Me.Controls.Add(MyTextBox)
            MyTextBox.Size = New System.Drawing.Size(0, 8)
            MyTextBox.Width = "600"
            MyTextBox.Height = "520"
        End Function
    -Ryan L
    http://denlou.com/

  2. #2
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171
    The SetParent API?


    Has someone helped you? Then you can Rate their helpful post.

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2004
    Posts
    2
    ooooh *smack*

    Must've been having a brain fart lol
    -Ryan L
    http://denlou.com/

  4. #4
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171


    Has someone helped you? Then you can Rate their helpful post.

  5. #5
    Addicted Member
    Join Date
    Apr 2004
    Location
    Lagos, Nigeria
    Posts
    215

    Re: Assign RichTextBox to Tabcontrol

    You can do tis the .NET way instead of calling the Windows API.
    You can do this by replacing:
    Code:
    Me.Controls.Add(MyTextBox)
    with:
    Code:
    myTabPage.Controls.Add(MyTextBox)
    It should work perfectly!



    Originally posted by denlou
    How do I get my newly created richtextbox inside my newly created tab?

    The tab and richtextbox creator works fine, but how do I get it work. Right now it's just putting the RichTextBox behind the tab.

    Code:
     
        Function NTab()
            Dim myTabPage As New TabPage
            myTabPage.Text = "Untitled" & (TabControl1.TabPages.Count + 1)
            TabControl1.TabPages.Add(myTabPage)
            Dim ControlCount As Integer
            Dim MyTextBox As RichTextBox
            MyTextBox = New RichTextBox
            Me.Controls.Add(MyTextBox)
            MyTextBox.Size = New System.Drawing.Size(0, 8)
            MyTextBox.Width = "600"
            MyTextBox.Height = "520"
        End Function

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