Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

[NOOB QUESTION] Make webbrowser navigate to the text box?

If i didnt explain it well enough in the title. I want to make it so if a user types in lets say www.google.com into a text box and then clicks a button it redirects the web browser to that url... I cant quite fiqure it out.. ( new to c#)


Really want to know this, thanks!
Code
private void button1_Click(object sender, EventArgs e)
{
      System.Uri uri = new System.Uri(textBox1.Text);
      webBrowser1.Url = uri;
}
[Image: MWjc9rm.png]
(Jun 13, 2017 12:54 PM)Lucifer Morningstar Wrote:  
Code
System.Uri uri = new System.Uri(textBox1.Text);
            webBrowser1.Url = uri;

Just as your posted this i worked it out! Thanks anyway.
If you are using visual studio there is a toolbox item called "WebBrowser" to put into your form. It does everything for you, here is the documentation https://msdn.microsoft.com/en-us/library....110).aspx
(Jun 13, 2017 12:55 PM)JAS Wrote:  Just as your posted this i worked it out! Thanks anyway.

Pro-tip: Always check the properties of that element. Usually there is a method.
[Image: MWjc9rm.png]
(Jun 13, 2017 12:56 PM)Lucifer Morningstar Wrote:  Pro-tip: Always check the properties of that element. Usually there is a method.

Thanks!
browser.Navigate(textbox.text)

You should learn how to use Google and how to use MSDN. MSDN has almost every class in C# and VB.net (and F#) documented really well and usually with example code.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by D3ath_GuNJan 3, 2020 01:49 PM 4 252 Jan 3, 2020 01:49 PM
Last Post: Krysis
[Shell] by Emre_Sep 2, 2019 07:07 PM 0 120 Sep 2, 2019 07:07 PM
Last Post: Emre_
[.NET] by isuDec 25, 2018 03:53 PM 3 200 Dec 25, 2018 03:53 PM
Last Post: StarZ