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.
Re: Convert string to URL
For future reference, the Uri class has several constructors that take a URL string as an argument.
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.
Re: Convert string to URL
isnt a url a string actually ?!!!
Re: Convert string to URL
Quote:
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.
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?
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")
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.
Re: Convert string to URL
Quote:
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")
:thumb:
it works perfectly I was looking for it so much.
thank Atheist
Re: Convert string to URL
Quote:
Originally Posted by mohkami
:thumb:
it works perfectly I was looking for it so much.
thank Atheist
You're welcome!
And welcome to VBForums :thumb:
Re: Convert string to URL
why dont just use WebBrowser.Navigate()?