Passing textbox value to command

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Parasyke

    #1

    Passing textbox value to command

    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(B yVal sender As System.Object, ByVal e As
    System.EventArg s) Handles Button1.Click
    Process.Start(" iexplore.exe", "http://www.microsoft.c om")
    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(B yVal sender As System.Object, ByVal e As
    System.EventArg s) Handles Button1.Click
    Process.Start(" iexplore.exe", Me.TextBox1.Val ue)
    End Sub

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

    Any ideas would help... Thanks!

  • Terry

    #2
    RE: Passing textbox value to command

    Just change Me.TextBox1.Val ue to Me.TextBox1.Tex t.
    --
    Terry


    "Parasyke" wrote:
    [color=blue]
    > 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(B yVal sender As System.Object, ByVal e As
    > System.EventArg s) Handles Button1.Click
    > Process.Start(" iexplore.exe", "http://www.microsoft.c om")
    > 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(B yVal sender As System.Object, ByVal e As
    > System.EventArg s) Handles Button1.Click
    > Process.Start(" iexplore.exe", Me.TextBox1.Val ue)
    > End Sub
    >
    > I'm sure I need to Dim the TextBox1 in some way and probably add more
    > code.
    >
    > Any ideas would help... Thanks!
    >
    >[/color]

    Comment

    Working...