Hello! I have this simple Internet browser. It works “fine”, but I’d like part of the URL (most of it actually) to be predetermined (always same website, but different pages). For example, I want to be able to type only some middle part of the URL & then click "Go!" and be able to connect to particular webpage in same website.

Here is what I mean (just an example):

somesite.com/johnb/profile/info.html
somesite.com/steveu/profile/info.html
somesite.com/karenk/profile/info.html
somesite.com/michaelv/profile/info.html

Instead of typing all these URLs, I want in the text box to type either "johnb" or ""steveu" or "karenk" or "michaelv" or whatever name/text can be and then be able to click "Go" and the code to automatically include what needs to be before these names/text and after as anything before and after always stays the same.


This is my web browser code:

'************************************

Public Class Form1

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

End Sub

Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted

End Sub

Private Sub GoBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GoBtn.Click

WebBrowser1.Url = New Uri(TextBox1.Text)

End Sub
End Class

'*************************************

Please help if you can. Thank you.

Change:

WebBrowser1.Url = New Uri(TextBox1.Text)

to:

WebBrowser1.Url = New Uri("http://www.somesite.com/" & TextBox1.Text & "/profile/info.html")

I ran this pointing to a real website and it worked just fine.

commented: Provides short but perfect solutions +1

Thank you. That was perfect!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.