SeptimusHeap wrote:
Erm, is there a possible way to add a close button on each tab without heaps of code?
I would use three things. A right click close, a menu bar close and an short cut key close. (Short cut keys usually activate the menu bar one)
This place is your friend (msdn)
http://msdn.microsoft.com/en-us/library/system.windows.forms.tabcontrol.tabpagecollection.remove.aspx
My site Offline
what-the wrote:
SeptimusHeap wrote:
Erm, is there a possible way to add a close button on each tab without heaps of code?
I would use three things. A right click close, a menu bar close and an short cut key close. (Short cut keys usually activate the menu bar one)
This place is your friend (msdn)
http://msdn.microsoft.com/en-us/library/system.windows.forms.tabcontrol.tabpagecollection.remove.aspx
but I really want the close buttons on the tab like on FF,
Offline
Oh, and this code comes up with an error every time I select the new tab. One tab is titled New and adds a new tab, but if I select that tab it produces an error in the red part:
Private Sub TabControl1_Selected(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged
If TabControl1.SelectedTab.ForeColor = Color.Coral Then
Dim Browse As New WebBrowser
TabControl1.TabPages.Add(1, "Blank")
TabControl1.SelectTab(i - 1)
Browse.Name = "wb"
Browse.Dock = DockStyle.Fill
TabControl1.SelectedTab.Controls.Add(Browse)
i = i + 1
Else
Me.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle & " - Ninjabrowse"
End If
End Sub
Offline
The following is from my tabed PDF file viewer. It would be nearly the same as the browser just replace the file location with the document title.
TabControl1.TabPages(i).Text = System.IO.Path.GetFileNameWithoutExtension(PDF_file) & ".pdf"
Me.Text = TabControl1.SelectedTab.Text & " - What-The PDF viewer"
My site Offline
what-the wrote:
The following is from my tabed PDF file viewer. It would be nearly the same as the browser just replace the file location with the document title.
TabControl1.TabPages(i).Text = System.IO.Path.GetFileNameWithoutExtension(PDF_file) & ".pdf"
Me.Text = TabControl1.SelectedTab.Text & " - What-The PDF viewer"
...
That's not the problem. I don't know the event after a tab - can you just read my posts please?
Offline
If you want a close button on the tab, I would make a subclass of whatever class the tab is, then reprogram the drawing method so it adds a close button. It might not be particularly easy though.
Offline
TheSuccessor wrote:
If you want a close button on the tab, I would make a subclass of whatever class the tab is, then reprogram the drawing method so it adds a close button. It might not be particularly easy though.
How do I make a subclass?
Offline
Class ClosableTab
Inherits TabPage
End ClassOffline
SeptimusHeap wrote:
TheSuccessor wrote:
If you want a close button on the tab, I would make a subclass of whatever class the tab is, then reprogram the drawing method so it adds a close button. It might not be particularly easy though.
How do I make a subclass?
You should put the class in another file. This is good for finding problems.
project
add new item
class
To refer to the class in your form.
Just type.
ClassName(Variables)
or ClassName() <-- no variables.
If the class returns a result
Result = ClassName()
or
Result = ClassName(variable)
My site Offline
SeptimusHeap wrote:
Oh, and this code comes up with an error every time I select the new tab. One tab is titled New and adds a new tab, but if I select that tab it produces an error in the red part:
Private Sub TabControl1_Selected(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged
If TabControl1.SelectedTab.ForeColor = Color.Coral Then
Dim Browse As New WebBrowser
TabControl1.TabPages.Add(1, "Blank")
TabControl1.SelectTab(i - 1)
Browse.Name = "wb"
Browse.Dock = DockStyle.Fill
TabControl1.SelectedTab.Controls.Add(Browse)
i = i + 1
Else
Me.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle & " - Ninjabrowse"
End If
End Sub
SpetimusHeap wrote:
Hmm, also, what event would I use whenever a page loads?
Help please!
And I don't understand this class stuff.
Offline
SeptimusHeap wrote:
And I don't understand this class stuff.
It's like in Squeak, if you understand that...
If you don't, here's an overview.
A class is a kind of blueprint for making objects. It is not already one of those objects.
You can create an instance of a class like this: new ClassName. It's like building something from the blueprints.
Sometimes you want a class to be like or extend an existing class. Rather than coding the class all over again, we can use this:
Class NewClassName
Implements BaseClassName
The new class will automatically have all the parts of the base class. You can add new methods or override old ones.
Offline
Just search how to make an advanced tabed web browser in vb.net click on the video and follow instructions.
My site Offline
what-the wrote:
Just search how to make an advanced tabed web browser in vb.net click on the video and follow instructions.
Please, I just want to fix my existing code.
Offline
Try
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle.ToString
When it gives an error message write the error message in a post.
My site Offline
what-the wrote:
Try
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle.ToString
When it gives an error message write the error message in a post.
OK. But what is this to help with? THis:
Dim Browse As New WebBrowser
TabControl1.TabPages.Add(1, "Blank")
TabControl1.SelectTab(i - 1)
Browse.Name = "wb"
Browse.Dock = DockStyle.Fill
TabControl1.SelectedTab.Controls.Add(Browse)
i = i + 1
is the problem because there's an error because I'm pretty sure the valuies are messed up, or there isn't a browser in the tab, or it reads the tab new, which has a coral background. And for some reason it stays on the 'New Tab' tab.
Index 0 is out of range.
Parameter name: index
Last edited by SeptimusHeap (2011-04-22 08:07:59)
Offline
Make sure i is set too the number of tabs you have.
I think you left it at one but you added a blank tab.
Try setting i to 2
Ok your code is putting the browser in the second last tab.
Type
Browse.Navigate("http://scratch.mit.edu")
at the end to see if it worked.
Last edited by what-the (2011-04-22 08:14:41)
My site Offline
Lol. I am doing so much of this browser thing. Please list people who have helped you build your project (Even just tips and pointers which helped you).
My site Offline
what-the wrote:
Lol. I am doing so much of this browser thing. Please list people who have helped you build your project (Even just tips and pointers which helped you).
Yeah, I know
I'm sorta a newb with VB.
Offline
still no. The new tab appears after the new tab tab, and when I select it, it produces an error D:
Offline
Time for a code dump and a print screen of what you have and errors. (Use code only for this area). Last time I was able to help you when you did that.
My site Offline
I'm going away for a few days. Someone else might be able to help you. Bye.
My site Offline
what-the wrote:
I'm going away for a few days. Someone else might be able to help you. Bye.
Nobody else will
Offline