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,
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.
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)
Re: Problem with string assignment escape character
thanks it working fine now...
Re: Problem with string assignment escape character