This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#26 2011-04-21 11:13:05

what-the
Scratcher
Registered: 2009-10-04
Posts: 1000+

Re: Need Visual Basic Help!

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


http://imageshack.us/m/64/9034/ddfss.pngMy site
Find someone post count. Click posts under username. Find number of pages. Times that by 40 for min and 60 for max and you have a rough estimate of post count.

Offline

 

#27 2011-04-21 16:36:59

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Need Visual Basic Help!

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

hmm  but I really want the close buttons on the tab like on FF,


http://i46.tinypic.com/dw7zft.png

Offline

 

#28 2011-04-21 17:30:52

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Need Visual Basic Help!

Hmm, also, what event would I use whenever a page loads?


http://i46.tinypic.com/dw7zft.png

Offline

 

#29 2011-04-21 17:44:37

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Need Visual Basic Help!

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


http://i46.tinypic.com/dw7zft.png

Offline

 

#30 2011-04-21 18:59:26

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Need Visual Basic Help!

Bump


http://i46.tinypic.com/dw7zft.png

Offline

 

#31 2011-04-21 22:27:50

what-the
Scratcher
Registered: 2009-10-04
Posts: 1000+

Re: Need Visual Basic Help!

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"


http://imageshack.us/m/64/9034/ddfss.pngMy site
Find someone post count. Click posts under username. Find number of pages. Times that by 40 for min and 60 for max and you have a rough estimate of post count.

Offline

 

#32 2011-04-22 07:12:06

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Need Visual Basic Help!

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?


http://i46.tinypic.com/dw7zft.png

Offline

 

#33 2011-04-22 07:23:30

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: Need Visual Basic Help!

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.


/* No comment */

Offline

 

#34 2011-04-22 07:25:49

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Need Visual Basic Help!

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?


http://i46.tinypic.com/dw7zft.png

Offline

 

#35 2011-04-22 07:33:31

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: Need Visual Basic Help!

Code:

Class ClosableTab
    Inherits TabPage

End Class

/* No comment */

Offline

 

#36 2011-04-22 07:43:34

what-the
Scratcher
Registered: 2009-10-04
Posts: 1000+

Re: Need Visual Basic Help!

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)


http://imageshack.us/m/64/9034/ddfss.pngMy site
Find someone post count. Click posts under username. Find number of pages. Times that by 40 for min and 60 for max and you have a rough estimate of post count.

Offline

 

#37 2011-04-22 07:46:44

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Need Visual Basic Help!

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.


http://i46.tinypic.com/dw7zft.png

Offline

 

#38 2011-04-22 07:57:13

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: Need Visual Basic Help!

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.


/* No comment */

Offline

 

#39 2011-04-22 07:58:08

what-the
Scratcher
Registered: 2009-10-04
Posts: 1000+

Re: Need Visual Basic Help!

Just search how to make an advanced tabed web browser in vb.net click on the video and follow instructions.


http://imageshack.us/m/64/9034/ddfss.pngMy site
Find someone post count. Click posts under username. Find number of pages. Times that by 40 for min and 60 for max and you have a rough estimate of post count.

Offline

 

#40 2011-04-22 08:00:32

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Need Visual Basic Help!

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.


http://i46.tinypic.com/dw7zft.png

Offline

 

#41 2011-04-22 08:03:58

what-the
Scratcher
Registered: 2009-10-04
Posts: 1000+

Re: Need Visual Basic Help!

Try
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle.ToString


When it gives an error message write the error message in a post.


http://imageshack.us/m/64/9034/ddfss.pngMy site
Find someone post count. Click posts under username. Find number of pages. Times that by 40 for min and 60 for max and you have a rough estimate of post count.

Offline

 

#42 2011-04-22 08:07:06

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Need Visual Basic Help!

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)


http://i46.tinypic.com/dw7zft.png

Offline

 

#43 2011-04-22 08:13:29

what-the
Scratcher
Registered: 2009-10-04
Posts: 1000+

Re: Need Visual Basic Help!

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)


http://imageshack.us/m/64/9034/ddfss.pngMy site
Find someone post count. Click posts under username. Find number of pages. Times that by 40 for min and 60 for max and you have a rough estimate of post count.

Offline

 

#44 2011-04-22 08:17:17

what-the
Scratcher
Registered: 2009-10-04
Posts: 1000+

Re: Need Visual Basic Help!

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).


http://imageshack.us/m/64/9034/ddfss.pngMy site
Find someone post count. Click posts under username. Find number of pages. Times that by 40 for min and 60 for max and you have a rough estimate of post count.

Offline

 

#45 2011-04-22 08:21:47

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Need Visual Basic Help!

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  tongue  I'm sorta a newb with VB.


http://i46.tinypic.com/dw7zft.png

Offline

 

#46 2011-04-22 08:23:07

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Need Visual Basic Help!

still no. The new tab appears after the new tab tab, and when I select it, it produces an error D:


http://i46.tinypic.com/dw7zft.png

Offline

 

#47 2011-04-22 09:18:21

what-the
Scratcher
Registered: 2009-10-04
Posts: 1000+

Re: Need Visual Basic Help!

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.


http://imageshack.us/m/64/9034/ddfss.pngMy site
Find someone post count. Click posts under username. Find number of pages. Times that by 40 for min and 60 for max and you have a rough estimate of post count.

Offline

 

#48 2011-04-22 16:41:42

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Need Visual Basic Help!

http://img62.imageshack.us/img62/9793/99250539.png

http://www.mediafire.com/?rofhrzc6rgaac7c


http://i46.tinypic.com/dw7zft.png

Offline

 

#49 2011-04-22 19:43:58

what-the
Scratcher
Registered: 2009-10-04
Posts: 1000+

Re: Need Visual Basic Help!

I'm going away for a few days. Someone else might be able to help you. Bye.


http://imageshack.us/m/64/9034/ddfss.pngMy site
Find someone post count. Click posts under username. Find number of pages. Times that by 40 for min and 60 for max and you have a rough estimate of post count.

Offline

 

#50 2011-04-22 19:47:48

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Need Visual Basic Help!

what-the wrote:

I'm going away for a few days. Someone else might be able to help you. Bye.

Nobody else will  sad


http://i46.tinypic.com/dw7zft.png

Offline

 

Board footer