|
-
May 8th, 2009, 06:48 AM
#1
Problem with string assignment escape character
Hi,
I am getting a escape character error when i assign a string to a text box with a '\' character
eg:
this.txtHeaderDirectory.Text = "C:\Temp";
so later i added excape character ' but still it is not working.. it is displaying C:''temp.. I want C:\Temp to be displayed.. how to do ?
thanks,
-
May 8th, 2009, 07:15 AM
#2
Re: Problem with string assignment escape character
Use @:
Code:
this.txtHeaderDirectory.Text = @"C:\Temp";
Do notice that string will be saved as is (with one backspace), but it will be shown as two backspaces during debugging. This is quite normal.
-
May 8th, 2009, 07:33 AM
#3
Re: Problem with string assignment escape character
Code:
this.txtHeaderDirectory.Text = "C:\\Temp"; // escape the backslash if you don't use the verbatim identifier (above)
-
May 10th, 2009, 11:51 PM
#4
Re: Problem with string assignment escape character
thanks it working fine now...
-
May 12th, 2009, 01:31 AM
#5
Re: Problem with string assignment escape character
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
|