Passing textbox value to command

  • Thread starter Thread starter Parasyke
  • Start date Start date
P

Parasyke

Please forgive this newbie, but can someone help with what is sure to
be simple for the veterans of VB.net:

I have a form with TextBox1 and a button, Button1.

I need to pass the value of the textbox (in this case a URL) into the
string which controls the opening of Internet Explorer and going to the
typed site.

I can get as far as opening Internet Explorer and opening a hard-coded
site:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Process.Start("iexplore.exe", "http://www.microsoft.com")
End Sub

But I want to alter the above to pick up the textbox value of the URL
with something like:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Process.Start("iexplore.exe", Me.TextBox1.Value)
End Sub

I'm sure I need to Dim the TextBox1 in some way and probably add more
code.

Any ideas would help... Thanks!
 
Back
Top