[RESOLVED] another string question for C#
I more or less finished the code conversion from my vb app to my c# app
however as allways there are a few weird bugs to work out
on i noticed today was that my filepath information has extra \\ added to the file path name
i assume that its becuase \ is an escape charter but how can add it to a variable litterly with out it adding the extra \
http://i10.tinypic.com/4868ll0.png
Re: another string question for C#
If you don't need any escape characters in your path then you can create a verbatim string literal:
Code:
string path = @"C:\MyFolder\MyFile.txt";
Re: another string question for C#
how can i apply that to
ofd_invoice.filename
Re: another string question for C#
You can't and you don't need to. The only reason to use it is to assign a literal string to a reference without having to escape any of the backslashes. There is no other use or need. If you're seeing escaped backslashes in the Watch window or somewhere like that it doesn't mean that your string contains double backslashes. That's just how string literals are displayed in C# so that's how the IDE displays them. If it just displayed single backslashes then how would it display escape characters?
Re: another string question for C#
Quote:
Originally Posted by Crash893
how can i apply that to
ofd_invoice.filename
You don't apply that to variables, just to values
Re: another string question for C#
okay i assuemed that that was the problem becuase it was saying that it could not find the file that i spessify in my OFD
i will have to take a closer look at see what else may be causeing it then
Thanks