Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there an equivalent to TEXT/ENDTEXT in C#?
Message
From
26/10/2004 20:08:55
Mike Sue-Ping
Cambridge, Ontario, Canada
 
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro and .NET
Miscellaneous
Thread ID:
00954090
Message ID:
00954741
Views:
21
Excellent. Thank you very much.

>>Hi Rick,
>>
>>Could you possibly post some sample code as to how you use the @ syntax in this situation?
>
>
>string Html = @"
><html>
><body>
>aslkdlaksdj alksdjalsdjalskdj
>asldjalskdjaslkdjalsdj
>asdkjasdlkjasdlkjasd
>alksdjlasjdlkasd
>
>Embedded Expression: {0}
></body>
></html>";
>
>Html = string.Format(Html,ExpressionToEmbed);
>
>
>The only thing you need to watch out for are embedded quotes which you can handle with double quotes or breaks in the text and then concatenating further.
>
>+++ Rick ---
>
>
>>Thanks for your assistance.
>>
>>Regards,
>>
>>Mike
>>
>>
>>
>>
>>>You can do most of that with the @ syntax. You just need to watch out for quote characters which need to be doubled.
>>>
>>>I use this all the time in my code generation routines and it works very well.
>>>
>>>+++ Rick ---
>>>
>>>
>>>>Thanks Rick. Perhaps I should give some details as to what I'm trying to do.
>>>>
>>>>I have a webBrowser control on my C# windows form. I want to display an HTML page. This page is static. I can simply have it sitting in a predetermined folder with a predetermined name. The content never changes. I don't want this html file always there, so after I'm thru showing it, I want to delete it. If the user navigates back to that page, the code will recreate it.
>>>>
>>>>For the latter, I was going to StreamWriteer.WriteLine(). While this works fine for short, simple pages, what I want to show is long and more complex and having to WriteLine() over and over and over is really going to do me in. I realize that once it is written, I don't have to redo it again, but, I dread the idea of even doing it once.
>>>>
>>>>As you know, the nice thing about VFP's TEXT was that it gave me the ability to simply cut and paste the entire content and then ENDTEXT it. Painless, over and done in seconds! Now if I could only find a similar way in .NET...
>>>>
>>>>Mike
>>>>
>>>>
>>>>>>Title says it all.
>>>>>>
>>>>>>Right now I find myself using the StreamWriter.WriteLine() which is a pain when I'm trying to create some HTML.
>>>>>
>>>>>
>>>>>If you're just trying to write out text without merging in C# use syntax liks this:
>>>>>
>>>>>
>>>>>SqlString =
>>>>>@"select * from someFile
>>>>>   where Id = 'SomeOtherString'
>>>>>   order by id
>>>>>";
>>>>>
>>>>>
>>>>>This works fine for everything except embedded quotes which must be escaped. You can also use string.Format() with this by embedding {0} {1} etc. and then using parameters which provides pseudo TextMerge behavior that is fairly effective.
>>>>>
>>>>>If you really need to textmerge there are some ways that you can do this, but they are all a lot of work. If you do serious templating you can use the ASP.NET engine to do this and this is really powerful.
>>>>>
>>>>>http://www.west-wind.com/presentations/aspnetruntime/aspnetruntime.asp
>>>>>
>>>>>If you just need to dynamically execute script you can also do this:
>>>>>
>>>>>http://www.west-wind.com/presentations/DynamicCode/DynamicCode.htm
>>>>>
>>>>>This may seem like a lot of work and it is, but these tools also give you a lot more functionalty than what you have available in VFP in terms of fine tuning how tis code runs. For example, the dynamic code execution allows you to launch code from different mahcines and code.
>>>>>
>>>>>
>>>>>REgards,
>>>>>
>>>>>+++ Rick ---
Previous
Reply
Map
View

Click here to load this message in the networking platform