-
Feb 22nd, 2012, 12:18 PM
#1
Thread Starter
Member
text box to label
-New User
I have a text box where a user types in his/her name. When the user clicks the command1 button the label2.caption will read
"welcome ___ to the...."
what code do I write in the command1 so whatever name i put in the text will be between "welcome" and "to the..."
label2.caption="?"
-
Feb 22nd, 2012, 12:34 PM
#2
Re: text box to label
Piece strings together via contcatenation; using &
Example: MsgBox "Hello " & "World. " & "How are you?"
-
Feb 22nd, 2012, 12:41 PM
#3
Re: text box to label
Code:
Private Sub Command1_Click()
Label1.Caption = "welcome " & Text.Text & " to VBForums."
End Sub
-
Feb 22nd, 2012, 12:43 PM
#4
Thread Starter
Member
Re: text box to label
Originally Posted by LaVolpe
Piece strings together via contcatenation; using &
Example: MsgBox "Hello " & "World. " & "How are you?"
sorry I don't understand your example , this is what I want
where it says "text1.text" should be whatever the user typed in the text1.text box.
label2.caption = "welcome text1.text to the..."
-
Feb 22nd, 2012, 12:45 PM
#5
Re: text box to label
label2.caption = "welcome " & text1.text & " to the..."
-
Feb 22nd, 2012, 12:45 PM
#6
Thread Starter
Member
Re: text box to label
Originally Posted by TysonLPrice
Code:
Private Sub Command1_Click()
Label1.Caption = "welcome " & Text.Text & " to VBForums."
End Sub
Thank You
-
Feb 22nd, 2012, 12:52 PM
#7
Thread Starter
Member
Re: text box to label
I also want the name from text1.text from form1 to appear on label1.caption on form2.
label1.caption="Please (text1.text from form1) select an option"
-
Feb 22nd, 2012, 12:56 PM
#8
Re: text box to label
Any control on any form can be accessed from any form. Just precede the control with the form's name:
Form1.Text1.Text
-
Feb 22nd, 2012, 12:56 PM
#9
Re: text box to label
label1.caption="Please " & form1.text1.text & " select an option"
-
Feb 22nd, 2012, 01:12 PM
#10
Thread Starter
Member
Re: text box to label
Originally Posted by LaVolpe
Any control on any form can be accessed from any form. Just precede the control with the form's name:
Form1.Text1.Text
Thank You
Originally Posted by TysonLPrice
label1.caption="Please " & form1.text1.text & " select an option"
Thank You
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|