Home All Groups Group Topic Archive Search About

Passing textbox value to command

Author
26 Jun 2006 8:01 PM
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!

Author
26 Jun 2006 8:38 PM
Terry
Just change Me.TextBox1.Value to Me.TextBox1.Text.
--
Terry


Show quoteHide quote
"Parasyke" wrote:

> 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!
>
>