Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB VisualStudio2012
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 2-Jan-13 2:20am
San Dra391
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Use this
 
MsgBox("Student " & txtName.Text & " "& txtLastName.Text &" are great at marks")
 
And BTW, your code does not work.. You are using + operator for concatening
  Permalink  
Comments
Aarti Meswania at 2-Jan-13 7:32am
   
5+ :)
aspnet_regiis -i at 2-Jan-13 7:44am
   
Thank you Aarti... :)
Aarti Meswania at 2-Jan-13 7:45am
   
Welcome! :)
San Dra at 2-Jan-13 9:01am
   
I tried but id doesn't work even without +...they still without space
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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

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

  Print Answers RSS
0 OriginalGriff 375
1 Sergey Alexandrovich Kryukov 329
2 CPallini 260
3 DamithSL 214
4 Maciej Los 197
0 OriginalGriff 5,455
1 DamithSL 4,457
2 Maciej Los 3,885
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,115


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 2 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100