Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

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

Variable - Super Easy question

How can I add "\" to this variable ?

Dim rootpath As String = "C:\TEST\" & txtDirectory.Text & ""

so it would look like

C:\TEST\200402\
0
JRockFL
Asked:
JRockFL
  • 3
1 Solution
 
S-TwilleyCommented:
rootpath &= "\"   '(which is short-hand for rootpath = rootpath & "\")
0
 
S-TwilleyCommented:
you might want to expand it a bit more to this:

If Not rootpath.Endswith("\") then rootpath &= "\"   (checks to make sure it doesnt already end with \ ... if it doesn't it adds it)
0
 
JRockFLAuthor Commented:
I also need txtDirectory.Text

Dim rootpath As String = "C:\TEST\" & txtDirectory.Text & ""
0
 
S-TwilleyCommented:
Those lines were meant to appear after that i.e.

Dim rootpath As String = "C:\TEST\" & txtDirectory.Text
If Not rootpath.Endswith("\") then rootpath &= "\"
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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