|
-
Jan 20th, 2006, 05:21 AM
#1
Thread Starter
Fanatic Member
Convert string to URL
This question is so easy I am embarressed.
vs 2005
Confusion exists within my realm today.
How oh how to covert :
"http://www.vbforums.com" to a url so I can make my embedded browser make use of it in my windows application.
Lordy I am thick.
-
Jan 20th, 2006, 05:35 AM
#2
Re: Convert string to URL
If you mean a Uri object so that you can assign it to the WebBrowser.Url property then don't even bother. Just call Navigate and pass the String.
-
Jan 20th, 2006, 05:37 AM
#3
Re: Convert string to URL
For future reference, the Uri class has several constructors that take a URL string as an argument.
-
Jan 20th, 2006, 05:49 AM
#4
Thread Starter
Fanatic Member
Re: Convert string to URL
I picked up the code from :
http://www.c-sharpcorner.com/Code/2004/Sept/WebBrowserControl.asp
And this in particular :
VB Code:
private void BrowseBtn_Click(object sender, EventArgs e)
{
webBrowser1.Url = UrlTextBox.Text;
}
Pain in the Pensi.
-
Jan 20th, 2006, 05:53 AM
#5
Hyperactive Member
Re: Convert string to URL
isnt a url a string actually ?!!!
My software never has bugs. It just develops random features.
I RATE, YOU RATE!!!
-
Jan 20th, 2006, 07:15 PM
#6
Re: Convert string to URL
 Originally Posted by Mosabama
isnt a url a string actually ?!!!
The Url property of the WebBrowser control is a Uri object. This is basically a wrapper for a URL string that allows you to do certain things with it in one line of code by using its properties and methods rather than writing your own code every time.
-
May 22nd, 2008, 10:10 AM
#7
New Member
Re: Convert string to URL
I'm using Microsoft VB 2005. In a Windows Application, the WebBrowser.Navigate() accepts a string argument. In a Windows Embedded CE 5.0 application, it only accepts a Uri. So, where can I find a method or a snippet to convert?
-
May 22nd, 2008, 10:27 AM
#8
Re: Convert string to URL
Create a new Uri and pass the string in the constructor.
C# Code:
Uri myUri = new Uri("http://www.vbforums.com")
-
May 22nd, 2008, 10:33 AM
#9
New Member
Re: Convert string to URL
Thanks, yes that does work. I used an argument of the form (TextBox1.Text) rather than a quoted string, and that works OK. One caution is that the argument must be an absolute URL or it causes a runtime exception.
-
Oct 3rd, 2008, 02:48 AM
#10
New Member
Re: Convert string to URL
 Originally Posted by Atheist
Create a new Uri and pass the string in the constructor.
C# Code:
Uri myUri = new Uri("http://www.vbforums.com")
it works perfectly I was looking for it so much.
thank Atheist
-
Oct 3rd, 2008, 06:28 AM
#11
Re: Convert string to URL
 Originally Posted by mohkami
it works perfectly I was looking for it so much.
thank Atheist
You're welcome!
And welcome to VBForums
-
Aug 19th, 2010, 02:41 AM
#12
New Member
Re: Convert string to URL
why dont just use WebBrowser.Navigate()?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|