• Log in or sign up for an account here: https://www.sythe.org/login

I wanted to make a world switcher in VB .NET 2005

  • Thread starter Thread starter Yubbz
  • Start date Start date
Y

Yubbz

Guest
Hey guys, I'm new and obviously don't know much about visual basic. And after getting bored with HTML, I decided to try some harder coding. Anyone help me out here?

What I have atm:

All of the Runescape world links.
Some ideas of what I want on the switcher.
The name :)
The design.


As you can see I only need the codes, or a tutorial on how to make a link on a form.. could someone please post a tutorial on how to make a link please, and thanks in advance!

~Yubbz
 
Make a command button for each world:

Code:
Private Sub Command1_Click()
 Webbrowser1.navigate ("link to runescape")
end sub

Stop Runescape redirection:

Code:
Private Sub WebBrowser_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean)
On Error Resume Next
If URL = "http://www.runescape.com/" Then Cancel = True
End Sub
 
Make a command button for each world:

Code:
Private Sub Command1_Click()
 Webbrowser1.navigate ("link to runescape")
end sub

Stop Runescape redirection:

Code:
Private Sub WebBrowser_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean)
On Error Resume Next
If URL = "http://www.runescape.com/" Then Cancel = True
End Sub

isnt that vb6?
 
1. Make a web browser control and unlock it from the parent form.
2. Make buttons for all the worlds.

Double click on each button and put in:

Code:
WebBrowser1.Navigate("http://www.runescape.com/linktoyourworld")

So in the end it should look almost like this:
Code:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        WebBrowser1.Navigate("http://www.runescape.com/linktoyourworld")
    End Sub

Now to stop Runescape from redirecting you to the main page, add in this at the very botton of your code:

Code:
Private Sub WebBrowser1_Navigating(ByVal sender As Object, ByVal e As
System.Windows.Forms.WebBrowserNavigatingEventArgs) Handles WebBrowser1.Navigating
  If (e.Url.ToString = "http://www.runescape.com/") Then
   e.Cancel = True ' cancels the redirection
  End If
End Sub

I've never used that code before so let me know if it works.
 
This is what i use and it works fine:
Code:
    Private Sub WebBrowser1_Navigating(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserNavigatingEventArgs) Handles WebBrowser1.Navigating
        If e.Url.AbsoluteUri = "http://www.runescape.com/" Then e.Cancel = True
    End Sub
 
yep, lol. BTW, technically it would be faster to make a world parser than writing all the worlds into the client. I parsed them :)
 
duelarena.gg
Back
Top