I am trying to set the Text property of a TextBox to the Url property of a WebBrowser. The code I have is:
textBox1.Text = webBrowser1.Url;
Visual Studio says:
"Cannot implicitly convert type System.Uri to string"
How do I set the textBox1.Text property to the value of the webBrowser1.Url?
You just need to call the ToString method:
textBox1.Text = webBrowser1.Url.ToString();
The webBrowser1.Url is of type System.Uri. To assign it to textbox, which is oftype string you can simply do a webBrowser1.Url.ToString() or use in-built properties like AbsoluteUri, OriginalString etc. depending on your requirement. For complete list of properties refer this MSDN link.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With