Can't get the text from the textbox into the Url function for the web browser - need urgent help

Well, i have been studying Visual Basic at school for the last few weeks, so my knowlege is very limited, plus the school version is only 6.0 instrad of express, so i am really on my own. I need help. i am attempting to put the text that is typed into a certain textbox into the "url" property of a web browser.

The error message that appears is the following: "Value of type 'String' cannot be converted to 'System.uri'."

I have absolutely no idea what that means. I will include the code that i have put in as so far to make sure that i haven't made any stupid mistakes.

Public Class Form1

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

SendKeys.Send(TextBox1.Text)

SendKeys.Send("{ENTER}")

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Timer1.Enabled = True

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

Timer1.Enabled = False

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

WebBrowser1.Url = TextBox2.Text

End Sub

End Class

I think the only theing worth worrying about is the third last line which says "WebBrowser1.Url = TextBox2.Text" which is where the error message keeps coming up. I've tried putting the text from the textbox into a subroutine (or something like that) and putting it from there into the "Url" property but it still didn't work. i thought maybe it's because the something between the texts was incompatible or something, but i must say that i am really clueless. Bottom line is, i need help




Answer this question

Can't get the text from the textbox into the Url function for the web browser - need urgent help

  • a.d.m

    The following should help you.

    Me.WebBrowser1.Url = New System.Uri(Me.TextBox2.Text)

    The property URL is looking for a value of type system.uri.


  • Can't get the text from the textbox into the Url function for the web browser - need urgent help