| View previous topic :: View next topic |
| Author |
Message |
AndrewMan Grandmaster Cheater Supreme
Reputation: 0
Joined: 01 Aug 2007 Posts: 1257
|
Posted: Sat Feb 23, 2008 9:59 pm Post subject: Multiple Tabs |
|
|
For a web-browser, how would you make tabbed browsing?
I added a web browser onto TabPage1.
This is the Go Button:
| Code: | | WebBrowser1.Navigate(TextBox1.Text) |
Now if I were to add onto TabPage2 a second web browser, It couldn't be:
| Code: | | WebBrowser1.Navigate(TextBox1.Text) |
because it would load that url onto both tabs.
How do I stop that from happening without adding a second TextBox.
EDIT: I tried this and it doesn't work:
| Code: | Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click, Button1.Enter
If TabPage2.Enabled = True Then
WebBrowser2.Navigate(TextBox1.Text)
WebBrowser1.Enabled = False
Else
WebBrowser1.Navigate(TextBox1.Text)
End If
WebBrowser1.Navigate(TextBox1.Text)
End Sub |
_________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sat Feb 23, 2008 10:36 pm Post subject: |
|
|
| Creating the controls at runtime would be a smarter way to go about this
|
|
| Back to top |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Sat Feb 23, 2008 10:42 pm Post subject: |
|
|
Put a panel on your form, and then throw a tab control thing on the panel.
Resize it to where the empty space from the tab control is the only area left visible on the panel. Make the panel's double click event do something like (C#):
| Code: |
WebBrowser wb = new WebBrowser();
wb.Size = tabControl1.Size; //this should be fitted, I don't feel like it right now
wb.Navigate("www.google.com");
TabPage tp = new TabPage();
tp.Controls.Add(wb);
tp.Tag = wb;
tabControl1.TabPages.Add(tp);
|
It's easy enough to translate to VB.
Now, for your Go button (once again, C#)
| Code: |
WebBrowser current = (WebBrowser)tabControl1.TabPages[tabControl1.TabIndex].Tag;
current.Navigate(whatever);
|
I think that should work.
_________________
|
|
| Back to top |
|
 |
AndrewMan Grandmaster Cheater Supreme
Reputation: 0
Joined: 01 Aug 2007 Posts: 1257
|
Posted: Sat Feb 23, 2008 11:14 pm Post subject: |
|
|
| samuri25404 wrote: | Put a panel on your form, and then throw a tab control thing on the panel.
Resize it to where the empty space from the tab control is the only area left visible on the panel. Make the panel's double click event do something like (C#):
| Code: |
WebBrowser wb = new WebBrowser();
wb.Size = tabControl1.Size; //this should be fitted, I don't feel like it right now
wb.Navigate("www.google.com");
TabPage tp = new TabPage();
tp.Controls.Add(wb);
tp.Tag = wb;
tabControl1.TabPages.Add(tp);
|
It's easy enough to translate to VB.
Now, for your Go button (once again, C#)
| Code: |
WebBrowser current = (WebBrowser)tabControl1.TabPages[tabControl1.TabIndex].Tag;
current.Navigate(whatever);
|
|
Wait so... those codes are for VB c# and not just VB? That's what i'm using.
Edit: Its not working. I also tried changing a few things like WebBrowser current to WebBrowser1.
Ahh Idk what to doooo
_________________
|
|
| Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Sun Feb 24, 2008 8:44 am Post subject: |
|
|
| There's no such thing "VB C#", its just C#... convert it.
|
|
| Back to top |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Sun Feb 24, 2008 9:59 am Post subject: |
|
|
Noo....
Google for a C# to VB.NET translator.
When you find one, put that code into it, and translate it.
Then, put in the code, where I told you to. There may be a few compile errors, and those you should just be able to fix yourself.
_________________
|
|
| Back to top |
|
 |
XxOsirisxX Grandmaster Cheater Supreme
Reputation: 0
Joined: 30 Oct 2006 Posts: 1597
|
Posted: Sun Feb 24, 2008 10:08 am Post subject: |
|
|
| AndrewMan wrote: | | samuri25404 wrote: | Put a panel on your form, and then throw a tab control thing on the panel.
Resize it to where the empty space from the tab control is the only area left visible on the panel. Make the panel's double click event do something like (C#):
| Code: |
WebBrowser wb = new WebBrowser();
wb.Size = tabControl1.Size; //this should be fitted, I don't feel like it right now
wb.Navigate("www.google.com");
TabPage tp = new TabPage();
tp.Controls.Add(wb);
tp.Tag = wb;
tabControl1.TabPages.Add(tp);
|
It's easy enough to translate to VB.
Now, for your Go button (once again, C#)
| Code: |
WebBrowser current = (WebBrowser)tabControl1.TabPages[tabControl1.TabIndex].Tag;
current.Navigate(whatever);
|
|
Wait so... those codes are for VB c# and not just VB? That's what i'm using.
Edit: Its not working. I also tried changing a few things like WebBrowser current to WebBrowser1.
Ahh Idk what to doooo  |
There are no WebBrowser on the example, the WebBrowser is being created at run time.
wb takes the control of a the control WebBrowser. (To make it shorted, and it's the example used everywhere).
_________________
|
|
| Back to top |
|
 |
|