Ask your own question, for FREE!
Computer Science 14 Online
OpenStudy (poopsiedoodle):

VB: What exactly is wrong with this code (see question)? I'll tell you the error once I post the code. @nincompoop

OpenStudy (poopsiedoodle):

`Private Sub NewToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles` `NewToolStripMenuItem1.Click` ` Dim Tab As New TabPage` ` Tab.Controls.Add(srtb)` ` srtb.Dock = DockStyle.Fill` ` Tab.Text = "New Document"` ` TabControl1.TabPages.Add(Tab)` ` End Sub`

OpenStudy (poopsiedoodle):

The problem is that when I click the toolstripmenuitem, it adds a new tab, but acts like I put srtb.dispose() for the previous tab. So, it adds a new tab, but takes the srtb control out of the already existing tab.

OpenStudy (e.mccormick):

This help? http://www.java2s.com/Tutorial/VB/0260__GUI/AddnewTab.htm

OpenStudy (poopsiedoodle):

not really :<

OpenStudy (opcode):

It probably conflicts with an earlier piece of code. Also why don't you try an easier method? ``` Dim myTabPage As New NewTab() myTabPage.Text = "NewTab" & (TabControl1.NewTabs.Count + 1) TabControl1.NewTabs.Add(myTabPage) ``` I typed that from my knowledge of C#. The converted it into VB.NET... It may bring a few errors, but wouldn't this be a simpler method? Basically its the same thing as yours, but cleaned up?

OpenStudy (poopsiedoodle):

Well, oppy, I already fixed it, but thanks though ♥

OpenStudy (opcode):

Of course you fixed it. You're a magnificent bastard. ♥

OpenStudy (poopsiedoodle):

This is what I had to do: `Dim srtb As New SyntaxHighlighter.SyntaxRichTextBox` ` Dim TabPage As New TabPage` ` TabPage.Controls.Add(srtb)` ` srtb.Dock = DockStyle.Fill` ` TabPage.Text = "New Document"` ` TabControl1.TabPages.Add(TabPage)`

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!