Bil Simser
|
Posted: 04/10/2003, 4:57 PM |
|
Hi guys,
I'm not sure how to do something without manually changing a CC generated
file. I want to replace my linefeeds in a memo field to display correctly
(using C#). I've created a label field and have it set to HTML. So now I
have something like this in my Before Show event for the form (pseudo code):
Form1_Field1.Text = Regex.Replace(Form1_Field1.Text, "\n", "<br>");
The problem is that CC generates the code but it can't find the
Regex.Replace function because I need to add the following to the header:
using System.Text.RegularExpressions;
The "using" section in the .cs file is not anything that I can seem to
change in CC. So the only option here is to manually add it when I generate
the code (every time).
Anyone know how to add new import statements to CC without manually changing
the C# source files? Thanks
|
|
|
Stefan Hogedal
|
Posted: 05/01/2003, 6:49 AM |
|
In this case it is much simpler:
Form1_Field1.Text = Form1_Field1.Text.Replace("\n", "<br>");
"Bil Simser" <bil_simser@cpr.ca> skrev i meddelandet
news:b750dd$15v$1@news.codecharge.com...
> Hi guys,
>
> I'm not sure how to do something without manually changing a CC generated
> file. I want to replace my linefeeds in a memo field to display correctly
> (using C#). I've created a label field and have it set to HTML. So now I
> have something like this in my Before Show event for the form (pseudo
code):
>
> Form1_Field1.Text = Regex.Replace(Form1_Field1.Text, "\n", "<br>");
>
> The problem is that CC generates the code but it can't find the
> Regex.Replace function because I need to add the following to the header:
>
> using System.Text.RegularExpressions;
>
> The "using" section in the .cs file is not anything that I can seem to
> change in CC. So the only option here is to manually add it when I
generate
> the code (every time).
>
> Anyone know how to add new import statements to CC without manually
changing
> the C# source files? Thanks
>
>
|
|
|
Bil Simser
|
Posted: 05/06/2003, 4:46 AM |
|
"Stefan Hogedal" <xxx_shogedal@hotmail.com> wrote in message
news:b8r8lt$47d$1@news.codecharge.com...
> In this case it is much simpler:
>
> Form1_Field1.Text = Form1_Field1.Text.Replace("\n", "<br>");
Thanks. I was hung up on the RegEx stuff but realized it could be done with
a simple string class. Works great!
|
|
|
|