Lakar Posted May 12, 2009 Report Posted May 12, 2009 (C#)Navigate To URL This code will allow your text box to be used as a navigate to URL bar, this will work with a web browser placed on your program. Note : To get this to navigate to a URL, you will need to make a Go button to activate this code. (Go to bottom of thread to see code for this button) public void NavigateToUrl() { Uri URL = default(Uri); try { URL = new Uri(textboxname.Text); } catch { try { URL = new Uri("http://www." + textboxname.Text); } catch { return; } } if ((URL.HostNameType == UriHostNameType.Dns) | (URL.HostNameType == UriHostNameType.IPv4)) { webbrowsername..Navigate(textboxname.Text); } else { string Host = URL.Host; Host = "http://www." + Host; try { webbrowsername.Navigate(Host); } catch { } } } Go Button Code private void gobutton_Click(object sender, EventArgs e) { if (ProgressBar1.Value < 100) { ProgressBar1.Value = 0; } NavigateToUrl(); if (ProgressBar1.Value < 100) { ProgressBar1.Value += 25; } } Enjoy-Lakar 1
Rogue Modder Posted June 10, 2010 Report Posted June 10, 2010 This is a bump, but your code is special.. WebBrowser1.Navigate(Textbox1.Text); that works fine..
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now