|
-
Dec 30th, 2011, 11:32 AM
#1
Thread Starter
Hyperactive Member
Tabbed Browser Help
I know people have asked this many times but i need some help. On howto create a new tab with code and how to delete it. I also asked this in an other thread but also how to make when you create a new tab it have a web browser in it? Thanks
-Sherlockturtle
-
Dec 30th, 2011, 03:22 PM
#2
Re: Tabbed Browser Help
Add
Code:
Dim newTab As New TabPage
Dim web As New WebBrowser
right under your "Public Form1"
This adds a new tab with a web browser in it:
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim lasttab As Integer = TabControl1.TabCount
TabControl1.TabPages.Add(newTab)
TabControl1.TabPages(lasttab).Controls.Add(web)
newTab.Text = "This is a new tab"
web.Dock = DockStyle.Fill
End Sub
This removes it
Code:
Dim lasttab As Integer = TabControl1.TabCount
TabControl1.TabPages.Remove(newTab)
-
Dec 30th, 2011, 05:17 PM
#3
Thread Starter
Hyperactive Member
Re: Tabbed Browser Help
 Originally Posted by dday9
Add
Code:
Dim newTab As New TabPage
Dim web As New WebBrowser
right under your "Public Form1"
This adds a new tab with a web browser in it:
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim lasttab As Integer = TabControl1.TabCount
TabControl1.TabPages.Add(newTab)
TabControl1.TabPages(lasttab).Controls.Add(web)
newTab.Text = "This is a new tab"
web.Dock = DockStyle.Fill
End Sub
This removes it
Code:
Dim lasttab As Integer = TabControl1.TabCount
TabControl1.TabPages.Remove(newTab)
Thank You
Edit: Two question is there a way to call that tab "tab" plus what tab number it is(Plus one each time) and i would be creating multiple tabs is there a way i could still make it all work.
I think i could do this by numbering each tab and taking that number and all the things on that page have that number in it. And search box could see what tab your on and add that number to all the things it does. Is there a way to see the current tab name? (Sorry if you dont understand i can try to refraze)
Last edited by sherlockturtle; Dec 30th, 2011 at 05:35 PM.
-
Dec 30th, 2011, 06:43 PM
#4
Re: Tabbed Browser Help
To get the current tab's name, it would be something along the lines of
Code:
Dim tabName As String = TabControl1.SelectedTab.Name
Console.WriteLine(tabName)
'Doesn't have to be console.writeline
'It could be label1.text = tabName or
'TabControl1.SelectedTab.Text = tabName
As for the other questions, I would like to see a little bit of work on your part. Try to get it done yourself, and then what ever errors you get post them here.
-
Dec 30th, 2011, 07:50 PM
#5
Thread Starter
Hyperactive Member
Re: Tabbed Browser Help
Ok.
The code you just game me does not work i used this"Dim ct As String = TabControl1.SelectedTab.Text"(i used text and name) and it kept saying this was wrong.
"Object reference not set to an instance of an object. "
But i cant figure out which object is wrong because tabcontrol1 is the tab controls name.
-
Dec 30th, 2011, 08:30 PM
#6
Thread Starter
Hyperactive Member
Re: Tabbed Browser Help
ive figured out what i was asking thanks.
-
Dec 30th, 2011, 11:59 PM
#7
Re: Tabbed Browser Help
You might like to follow the CodeBank link in my signature and check out my Tabbed Web Browser thread. I never did get around to finishing it to the degree I intended but it demonstrates solutions to many of the basic problems.
-
Dec 31st, 2011, 11:10 AM
#8
Thread Starter
Hyperactive Member
Re: Tabbed Browser Help
 Originally Posted by jmcilhinney
You might like to follow the CodeBank link in my signature and check out my Tabbed Web Browser thread. I never did get around to finishing it to the degree I intended but it demonstrates solutions to many of the basic problems.
thanks
Ive been using this to navigate and other things
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(ComboBox1.Text)
but im only abel to get two tabs then when i create a third or fourth only the first one works. I can give more code if you need.
Last edited by sherlockturtle; Dec 31st, 2011 at 11:19 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|