|
-
Sep 24th, 2006, 01:01 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] problem with string
i am trying to declare a string in C#
string
writePath,
billMonth,
startPath = '\\filervoca\groups\edit\public' ;
for startPath i get an error for either ' or " im not sure how to intalize thie value to this network folder.
thanks
crash
-
Sep 24th, 2006, 01:13 PM
#2
Member
Re: problem with string
declare your string as
Code:
public string startPath = "\\filervoca\\groups\\edit\\public" ;
or
public string startPath2 = @"\\filervoca\groups\edit\public";
I beleive the single \ is an escape clause and by either putting a double \\ or by placing the @ before the path it turns it into a literal(sp) path.
I'm sure others will correct my example but the code working in my test.
Al
-
Sep 24th, 2006, 01:17 PM
#3
Re: problem with string
Code:
public string startPath = "\\\\filervoca\\groups\\edit\\public" ;
4 \s to get \\
-
Sep 24th, 2006, 01:20 PM
#4
Member
Re: problem with string
 Originally Posted by Harsh Gupta
Code:
public string startPath = "\\\\filervoca\\groups\\edit\\public" ;
4 \s to get \\ 
Good shout Harsh Gupta!
-
Sep 24th, 2006, 01:49 PM
#5
Re: problem with string
I remember when they told me to do things the easy way
Code:
string startPath = @"\\filervoca\groups\edit\public";
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Sep 24th, 2006, 01:58 PM
#6
Thread Starter
Fanatic Member
-
Sep 24th, 2006, 06:19 PM
#7
Re: [RESOLVED] problem with string
If you have only escape backslashes in a string then don't use the verbatim operator, e.g.
Code:
myTextBox.Text = "line 1\nline 2";
If you have only literal backslashes in a string then do use the verbatim operator, e.g.
Code:
myTextBox.Text = @"The path is C:\Files\MyFile.txt";
If you have both escape and literal backslashes then don't use the verbatim operator and do escape your literal backslashes, e.g.
Code:
myTextBox.Text = "The path is as follows:\n\"C:\\Files\\MyFile.txt\"";
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
|