Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Hi, What can i use to have a space between txtbox1 amd txtbox2:

I mean Look:

in this code here
MsgBox("Student " & txtName.Text & txtLastName.Text + "are great at marks")

It displays: StudentJohnDwight are great at marks


How can I do to shows like that: Student john Dwight are great at marks?
Posted

As an alternative, you may use the String.Format[^] method:
VB
 Dim msg As String
 msg = String.Format("Student {0} {1} are great at marks", txtName.Text, txtLastName.Text)
MsgBox(msg)
 
Share this answer
 
Comments
bbirajdar 2-Jan-13 7:45am    
I would recommend this alternative, since it uses String.Format +5
Aarti Meswania 2-Jan-13 7:45am    
5+ :)
Use this

VB
MsgBox("Student " & txtName.Text & " "& txtLastName.Text &" are great at marks")


And BTW, your code does not work.. You are using + operator for concatening
 
Share this answer
 
Comments
Aarti Meswania 2-Jan-13 7:32am    
5+ :)
bbirajdar 2-Jan-13 7:44am    
Thank you Aarti... :)
Aarti Meswania 2-Jan-13 7:45am    
Welcome! :)
San Dra 2-Jan-13 9:01am    
I tried but id doesn't work even without +...they still without space

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900