Click here to Skip to main content
15,896,342 members
Home / Discussions / C#
   

C#

 
GeneralRe: Turning off the insertion point. Pin
PIEBALDconsult29-Dec-06 4:22
mvePIEBALDconsult29-Dec-06 4:22 
GeneralRe: Turning off the insertion point. Pin
dbetting29-Dec-06 13:59
dbetting29-Dec-06 13:59 
GeneralRe: Turning off the insertion point. Pin
jk chan28-Dec-06 16:52
jk chan28-Dec-06 16:52 
GeneralRe: Turning off the insertion point. Pin
Jamestown4828-Dec-06 16:59
Jamestown4828-Dec-06 16:59 
GeneralRe: Turning off the insertion point. Pin
jk chan28-Dec-06 17:19
jk chan28-Dec-06 17:19 
GeneralRe: Turning off the insertion point. Pin
jk chan28-Dec-06 17:33
jk chan28-Dec-06 17:33 
QuestionString to URL Pin
dsl/fahk28-Dec-06 11:48
dsl/fahk28-Dec-06 11:48 
AnswerRe: String to URL Pin
Judah Gabriel Himango28-Dec-06 12:32
sponsorJudah Gabriel Himango28-Dec-06 12:32 
I assume you mean System.Uri, not System.Url.

Uri uri = new Uri(textBox.Text);


Alternately, you can use the TryCreate static method of the Uri class to attempt to create a URI. Unlike the above method, which throws an exception if the text of the text box is not a valid URI (for instance, if you forgot to type the "http://" part of www.google.com), TryCreate will tell you if it's a valid URI without throwing any errors:

Uri validUri;
bool isValidUri = Uri.TryCreate(textBox.Text, UriKind.Absolute, out validUri);
if(isValidUri)
{
    // Now you can use validUri object.
}


p.s. You don't need to convert the text to System.Uri in order to call webBrowser.Navigate. Look at the System.Navigate method overloads[^], notice that one of them takes a string. With that, you can just call
browser.Navigate(textBox.Text);


Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Guess who's having a birthday? (It's not Jesus)
The apostle Paul, modernly speaking: Epistles of Paul

Judah Himango


GeneralRe: String to URL Pin
dsl/fahk28-Dec-06 12:39
dsl/fahk28-Dec-06 12:39 
GeneralRe: String to URL Pin
jk chan28-Dec-06 17:12
jk chan28-Dec-06 17:12 
QuestionIndexer vs function Pin
axos8828-Dec-06 10:22
axos8828-Dec-06 10:22 
AnswerRe: Indexer vs function [modified] Pin
Luc Pattyn28-Dec-06 10:44
sitebuilderLuc Pattyn28-Dec-06 10:44 
Questionhi, c# forms Pin
sopho2428-Dec-06 10:07
sopho2428-Dec-06 10:07 
AnswerRe: hi, c# forms Pin
karam chandrabose28-Dec-06 15:33
karam chandrabose28-Dec-06 15:33 
AnswerRe: hi, c# forms Pin
Flysocket28-Dec-06 20:19
Flysocket28-Dec-06 20:19 
GeneralRe: hi, c# forms Pin
sopho2429-Dec-06 12:56
sopho2429-Dec-06 12:56 
QuestionHide form at startup Pin
Mike Hankey28-Dec-06 9:54
mveMike Hankey28-Dec-06 9:54 
AnswerRe: Hide form at startup Pin
sopho2428-Dec-06 10:25
sopho2428-Dec-06 10:25 
GeneralRe: Hide form at startup Pin
Mike Hankey28-Dec-06 10:39
mveMike Hankey28-Dec-06 10:39 
GeneralRe: Hide form at startup Pin
sopho2428-Dec-06 10:49
sopho2428-Dec-06 10:49 
GeneralRe: Hide form at startup Pin
Mike Hankey28-Dec-06 10:56
mveMike Hankey28-Dec-06 10:56 
AnswerRe: Hide form at startup Pin
Nader Elshehabi28-Dec-06 10:54
Nader Elshehabi28-Dec-06 10:54 
GeneralRe: Hide form at startup Pin
Mike Hankey28-Dec-06 11:00
mveMike Hankey28-Dec-06 11:00 
GeneralRe: Hide form at startup Pin
Nader Elshehabi28-Dec-06 11:31
Nader Elshehabi28-Dec-06 11:31 
GeneralRe: Hide form at startup Pin
Mike Hankey28-Dec-06 11:48
mveMike Hankey28-Dec-06 11:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.