Results 1 to 4 of 4

Thread: [RESOLVED] How Do I Convert a string to URI?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2007
    Posts
    21

    Resolved [RESOLVED] How Do I Convert a string to URI?

    I'm reading a string from a text file, and want to use that string as the URL for my web browser object. The error I get is it needs to be URI, but I am completely lost on how to make a string into URI.

    As always, any help is appreciated.

  2. #2
    Frenzied Member stimbo's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    1,739

    Re: How Do I Convert a string to URI?

    Without seeing what code you are dealing with exactly it's a little bit difficult to say what you want exactly. But if you take this it might provide you with an idea:
    vb Code:
    1. Dim myString As String = "http://www.bbc.co.uk"
    2.  
    3. Me.WebBrowser1.Navigate(New Uri(myString))
    Stim

    Free VB.NET Book Chapter
    Visual Basic 2005 Cookbook Sample Chapter

  3. #3

    Thread Starter
    Junior Member
    Join Date
    May 2007
    Posts
    21

    Re: How Do I Convert a string to URI?

    Quote Originally Posted by stimbo
    Without seeing what code you are dealing with exactly it's a little bit difficult to say what you want exactly. But if you take this it might provide you with an idea:
    vb Code:
    1. Dim myString As String = "http://www.bbc.co.uk"
    2.  
    3. Me.WebBrowser1.Navigate(New Uri(myString))
    Thanks! With a little tweaking that worked perfectly.

  4. #4
    New Member
    Join Date
    Nov 2008
    Location
    VA
    Posts
    9

    Lightbulb Re: [RESOLVED] How Do I Convert a string to URI?

    For the C# in all of us (even if this is a VB forum...)...
    Code:
    string myUrl = "http://www.vbforums.com";
    Uri myUri = new Uri(myUrl);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width