Solved

create spaces in vb string

Posted on 2014-04-27
8
289 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
 
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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

911 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now