|
-
Jun 22nd, 2006, 01:05 AM
#1
Thread Starter
Hyperactive Member
[2005]Simple Concatenation
VB Code:
MsgBox(tboxFirstName.Text + tboxLastName.Text + "has been deleted", MsgBoxStyle.Exclamation, "Delete")
This code outputed with the firstname and lastname stating has been delete...My question is how can I put a space between firstname and lastname as well as to the string "has been deleted"?thanks in advance....
-
Jun 22nd, 2006, 01:34 AM
#2
Re: [2005]Simple Concatenation
You are joining strings together. If you want another string in between the first name and last name then just put an extra string in there: one that contains a single space. Also, if you want a space before the word "has" then just put one in the string. You've got a space after the word so why can't you put one before it?
Note that you may also want to consider using the "&" operator instead of "+". You may also like to investigate the String.Format method, which makes things much more readable when concatenating multiple strings.
Last edited by jmcilhinney; Jun 22nd, 2006 at 01:39 AM.
-
Jun 22nd, 2006, 01:34 AM
#3
Hyperactive Member
Re: [2005]Simple Concatenation
You just need to add a space character!
Give this a whirl
VB Code:
MsgBox(tboxFirstName.Text & " " & tboxLastName.Text & " has been deleted", MsgBoxStyle.Exclamation, "Delete")
You might also want to consider using Windows.Forms.MessageBox.Show(..), instead of MsgBox.
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
|