Re: Q: loading Crystal report 10 from file



There is only one thing I can see that's wrong, and it's subtle.

A backslash in C# string tells the compiler to interpret the following
character as special. So, when you wrote:

"c:\rep1.rpt"

what the compiler saw was [c] [:] [carriage return] [e] [p] [1] [.] [r]
[p] [t]. So what's that carriage return doing there? Well, it's what
"\r" stands for. In order to get a backslash in a C# string you have to
do one of two things. Either write

"c:\\rep1.rpt" which works because a double backslash in a normal
string resolves to a single backslash (i.e.: "Treat the next character
as special: it's a real backslash."), or

@"c:\rep1.rpt" which works because the @ preceding the opening quote
tells the compiler, "There are no special characters in this string;
treat every character exactly as shown."

So, you should write either:

aRep.Load("c:\\rep1.rpt", OpenReportMethod.OpenReportByTempCopy);

or

aRep.Load(@"c:\rep1.rpt", OpenReportMethod.OpenReportByTempCopy);

.



Relevant Pages

  • Re: PL/I string representations
    ... >> of the language, so it was interesting to me, hopefully it will be to ... I found a workable compiler for Fortran in 1971 (with a bug ... >> The specified length is the minimum, and each time a character ... >> string is assigned to E, the length is stored with it. ...
    (comp.programming)
  • Re: gfortran diagnostics and so on
    ... Well, in f0003, backslash is part of the standard Fortran character set. ... Because the backslash is part of the standard Fortran character set, the default behavior should be the printable character, **NOT** some kind of magic introductory character that transforms the interpretation of following character. ... The one I like best is to use one of the popular extensions to designate a particular literal string according to the C language. ...
    (comp.lang.fortran)
  • Re: Convert to /
    ... |> Why is it so hard to convert backslashes to forward slashes in java? ... | character immediately after the colon would be the tab ... | get a backslash character into a string literal in Java ...
    (comp.lang.java.help)
  • Re: To "TAB" or not to "TAB"
    ... > negative I want etc. in character strings now in every compiler I'm ... If there is a graphic character in the string, ... that you are saying that the compiler should do no special processing, ...
    (comp.lang.fortran)
  • Re: when substring equals string
    ... CHARACTER:: String ... The unit number is attached to a file via an OPEN statement. ... question is about a character variable, ... Like in the way the operator invoked the compiler. ...
    (comp.lang.fortran)