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

Recommended Answers

All 2 Replies

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
commented: great! +1

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.