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
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!
Quote:
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