I wrote a simple C # browser, but it does not work, although it should! Help me please. All the necessary components are connected.

using System; using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; namespace ololo { public partial class MainForm : Form { string author = "johniek_comp"; public MainForm() { InitializeComponent(); } void Button1Click(object sender, EventArgs e) { label1.Text = "developed by "+author; } void Button2Click(object sender, EventArgs e) { label2.Text = "загрузка..."; webBrowser1.Navigate("http://"+textBox1.Text); } void Label2Click(object sender, EventArgs e) { label2.Text = ""; } } } 

And how to make it so that in what you enter in text.Box1 loaded? as I indicated in the first post

  • one
    @johniek_comp is obviously the same. See my message. - VioLet

1 answer 1

Because the WebBrowser.Navigate method accepts a Uri object as a parameter, and not a simple string.
You need something like this:

 webBrowser1.Navigate(new Uri("http://"+ textBox1.Text));