Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 300
  • Last Modified:

create spaces in vb string

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
patelbg2001
Asked:
patelbg2001
3 Solutions
 
Rgonzo1971Commented:
Hi,

Maybe

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

Open in new window

Regards
0
 
AndyAinscowCommented:
The & will put the strings together directly.  If you want spaces then just add them into the strings.
0
 
patelbg2001Author Commented:
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
MacroShadowCommented:
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
 
patelbg2001Author Commented:
how would a chr(32) be used?
0
 
MacroShadowCommented:
Dim pscommand As Command = New Command("MailboxReport -SAID" & Strings.Chr(32) & r & Strings.Chr(32) & "-TXTPATH" & Strings.Chr(32) & q)
0
 
patelbg2001Author Commented:
Thanks, I'll remember that for the future.
B.
0
 
MacroShadowCommented:
No prob.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now