Solved

create spaces in vb string

Posted on 2014-04-27
8
291 Views
Last Modified: 2014-04-27
if this command :- Dim pscommand As Command = New Command("MailboxReport -SAID" & r & "-TXTPATH" & q)

is represented into vb like this : - "MailboxReport -SAID11364-TXTPATHC:\WHATEVER".  

How can I spave the command correctly with spaces to produce this result  : -

"MailboxReport -SAID 11364 -TXTPATH C:\WHATEVER".
0
Comment
Question by:patelbg2001
8 Comments
 
LVL 49

Assisted Solution

by:Rgonzo1971
Rgonzo1971 earned 166 total points
ID: 40025612
Hi,

Maybe

Dim pscommand As Command = New Command("MailboxReport -SAID " & r & " -TXTPATH " & q) 

Open in new window

Regards
0
 
LVL 44

Assisted Solution

by:AndyAinscow
AndyAinscow earned 167 total points
ID: 40025625
The & will put the strings together directly.  If you want spaces then just add them into the strings.
0
 
LVL 6

Author Comment

by:patelbg2001
ID: 40025629
like this example ?(Sorry for the basic question, I'm relearning since my stroke)

Dim q As String = physicalFolder.ToString
Dim r As String = TextBox1.Text
Dim firstString As String
Dim secondString As String
Dim startString As String
firstString = "-SAID"
secondString = "-TXTPATH"
firstString = firstString & " "
secondString = secondString & " "
firstString = firstString & r
secondString = secondString & q
firstString = firstString & " "
startString =”MailboxReport”
startString=startString & “ “
Dim pipe As Pipeline = rs.CreatePipeline()
Dim pscommand As Command = New Command(startString &  firstString  &  secondString)
pipe.Commands.Add(pscommand)
pipe.Invoke()

Open in new window

0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 27

Accepted Solution

by:
MacroShadow earned 167 total points
ID: 40025660
Either like that, or even better and shorter like Rgonzo1971's suggestion.

Also instead of " " you could use chr(32), which represents a space character.
0
 
LVL 6

Author Comment

by:patelbg2001
ID: 40025723
how would a chr(32) be used?
0
 
LVL 27

Expert Comment

by:MacroShadow
ID: 40025726
Dim pscommand As Command = New Command("MailboxReport -SAID" & Strings.Chr(32) & r & Strings.Chr(32) & "-TXTPATH" & Strings.Chr(32) & q)
0
 
LVL 6

Author Comment

by:patelbg2001
ID: 40025782
Thanks, I'll remember that for the future.
B.
0
 
LVL 27

Expert Comment

by:MacroShadow
ID: 40025790
No prob.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question