DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   VB.NET (http://www.daniweb.com/forums/forum58.html)
-   -   Web browser with predermined par of URL (http://www.daniweb.com/forums/thread113393.html)

leokuz Mar 11th, 2008 7:11 pm
Need Web Browser with Part the of URL Being Predermined
 
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.

bwkeller Mar 11th, 2008 9:41 pm
Re: Web browser with predermined par of URL
 
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.

leokuz Mar 12th, 2008 2:57 pm
Re: Web browser with predermined par of URL
 
Thank you. That was perfect!


All times are GMT -4. The time now is 4:06 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC