Hey guys, i'm just starting in VB and am experimenting with programs. I'm trying to make a simple program that when you type in your name and phone number it displays it in a label. So i have everything good up until getting the info from the box to the label. I'm drawing a blank. I think it has to be something like this but i could be totally wrong, this is more how java would look :P

Label1.Text = "Your name is " TextBox1.Text " and your phone number is "MaskedTextBox1.Text

help! thanks

6 Years
Discussion Span
Last Post by eikal

If you're using vb.net this one will do:

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

        Label1.Text = TextBox1.Text

    End Sub

or i'm not sure if this is what you want:

Label1.Text = "Your name is " & TextBox1.Text & "and your phone number is " & MaskedTextBox1.Text
Votes + Comments

The second one was what i wanted, thanks! :) i've been told i code the long way but it helps me learn the code better so i do it this way. haha

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.