473,394 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Displaying Text in a RichtText Control Problems,...

Hi,

i have text like this:

"ACPI\GENUINEINTEL_-_X86_FAMILY_6_MODEL_13\_0"

an after displaying it in a RichTextBox as RTF string, i get this:

"ACPI_-_x86_Family_6_Model_13 "

How can i enclose this text section, so that the RTF Engine
does it print exactly the way it is add and does not treat
backslashes and stuff like that as control charatcers,...

I know that it is a little OT, but i did not kow where to ask,...

TIA,...

Regards

Kerem
--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Latest Project: http://www.codeplex.com/restarts
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."

Aug 28 '08 #1
10 1522
Hello Kerem,

How are you inserting the string in the RichTextBox?

If you use the property "Text", it should work... Something like:

yourRichTextBox.Text = @"ACPI\GENUINEINTEL_-_X86_FAMILY_6_MODEL_13\_0";

or

yourRichTextBox.Text = "ACPI\\GENUINEINTEL_-_X86_FAMILY_6_MODEL_13\\_0";

Cheers,
Caio Proiete

Hi,

i have text like this:

"ACPI\GENUINEINTEL_-_X86_FAMILY_6_MODEL_13\_0"

an after displaying it in a RichTextBox as RTF string, i get this:

"ACPI_-_x86_Family_6_Model_13 "

How can i enclose this text section, so that the RTF Engine does it
print exactly the way it is add and does not treat backslashes and
stuff like that as control charatcers,...

I know that it is a little OT, but i did not kow where to ask,...

TIA,...

Regards

Kerem

Aug 28 '08 #2
Hi Caoi,

i insert is as a formated RichText, because i want a
basic format for it. The RTF String looks like:
@"{\rtf1 {\colortbl ;\red0\green128\blue0;\red0\green0\blue255;}{\b " +
ObjectProperty.Name + @"} \par \b0 {" + da.Description + @"}\par {\b
Value: }\cf1\b0 " + ObjectValue + @" \b0 \par}";

Its an excerpt from an self-made property grid, where this block is the part
or the description pane in the lower part of the property gridls panel. The
Problem for the Rtf-Property of the RichTextBox are the "\" Backslashes,
since everything after it will be considered as a cotrol command. But there
must be some way to enclose the String as a non Rtf string or like something
"treat the string as is" inside a RFT string,...

Is there a way

Regards

Kerem

--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Latest Project: http://www.codeplex.com/restarts
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
"Caio Proiete [MCT]" <ca***************@proiete.comschrieb im Newsbeitrag
news:c6************************@msnews.microsoft.c om...
Hello Kerem,

How are you inserting the string in the RichTextBox?

If you use the property "Text", it should work... Something like:

yourRichTextBox.Text = @"ACPI\GENUINEINTEL_-_X86_FAMILY_6_MODEL_13\_0";

or

yourRichTextBox.Text = "ACPI\\GENUINEINTEL_-_X86_FAMILY_6_MODEL_13\\_0";

Cheers,
Caio Proiete

>Hi,

i have text like this:

"ACPI\GENUINEINTEL_-_X86_FAMILY_6_MODEL_13\_0"

an after displaying it in a RichTextBox as RTF string, i get this:

"ACPI_-_x86_Family_6_Model_13 "

How can i enclose this text section, so that the RTF Engine does it
print exactly the way it is add and does not treat backslashes and
stuff like that as control charatcers,...

I know that it is a little OT, but i did not kow where to ask,...

TIA,...

Regards

Kerem

Aug 28 '08 #3
Hum.. Okay.

Just replace each backslash to *two* backslashes, as do in C# when you don't
use the "@" :).

Something like:

@"{\rtf1 {\colortbl ;\red0\green128\blue0;\red0\green0\blue255;}{\b "
+ ObjectProperty.Name.Replace(@"\", @"\\")
+ @"} \par \b0 {"
+ da.Description
+ @"}\par {\b Value: }\cf1\b0 "
+ ObjectValue.ToString().Replace(@"\", @"\\")
+ @" \b0 \par}";
This is probably not be the most efficient solution, though... You should
think of using a StringBuilder and use the Append method to build the correct
RTF string...

--
Caio Proiete
http://www.caioproiete.com
-
Hi Caoi,

i insert is as a formated RichText, because i want a basic format for
it. The RTF String looks like:

@"{\rtf1 {\colortbl ;\red0\green128\blue0;\red0\green0\blue255;}{\b "
+ ObjectProperty.Name + @"} \par \b0 {" + da.Description + @"}\par {\b
Value: }\cf1\b0 " + ObjectValue + @" \b0 \par}";

Its an excerpt from an self-made property grid, where this block is
the part or the description pane in the lower part of the property
gridls panel. The Problem for the Rtf-Property of the RichTextBox are
the "\" Backslashes, since everything after it will be considered as a
cotrol command. But there must be some way to enclose the String as a
non Rtf string or like something "treat the string as is" inside a RFT
string,...

Is there a way

Regards

Kerem

Aug 28 '08 #4
Hi Caio,
>Just replace each backslash to *two* backslashes, as >do in C# when you
don't use the "@" :).
well, this is no real solution, since the could be a
situation were you have to backslashes and then
you will have three there. There must be some way,
to represent a string as is inside a RTF string. I could
not find something i the RTF Documentation yet, but
there should be some way. The @ quoting is no
difference to me or the string.append or other string
methods. Here is no need for them,...

Maybe there is another solution,...

Regards

Kerem
--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Latest Project: http://www.codeplex.com/restarts
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
"Caio Proiete [MCT]" <ca***************@proiete.comschrieb im Newsbeitrag
news:c6************************@msnews.microsoft.c om...
Hum.. Okay.

Just replace each backslash to *two* backslashes, as do in C# when you
don't use the "@" :).

Something like:

@"{\rtf1 {\colortbl ;\red0\green128\blue0;\red0\green0\blue255;}{\b "
+ ObjectProperty.Name.Replace(@"\", @"\\") + @"} \par \b0 {" +
da.Description + @"}\par {\b Value: }\cf1\b0 " +
ObjectValue.ToString().Replace(@"\", @"\\") + @" \b0 \par}";
This is probably not be the most efficient solution, though... You should
think of using a StringBuilder and use the Append method to build the
correct RTF string...

--
Caio Proiete
http://www.caioproiete.com
-
>Hi Caoi,

i insert is as a formated RichText, because i want a basic format for
it. The RTF String looks like:

@"{\rtf1 {\colortbl ;\red0\green128\blue0;\red0\green0\blue255;}{\b "
+ ObjectProperty.Name + @"} \par \b0 {" + da.Description + @"}\par {\b
Value: }\cf1\b0 " + ObjectValue + @" \b0 \par}";

Its an excerpt from an self-made property grid, where this block is
the part or the description pane in the lower part of the property
gridls panel. The Problem for the Rtf-Property of the RichTextBox are
the "\" Backslashes, since everything after it will be considered as a
cotrol command. But there must be some way to enclose the String as a
non Rtf string or like something "treat the string as is" inside a RFT
string,...

Is there a way

Regards

Kerem

Aug 28 '08 #5
On Aug 29, 3:47*am, Kerem Gümrükcü <kareem...@hotmail.comwrote:
Hi Caio,
Just replace each backslash to *two* backslashes, as >do in C# when you
don't use the "@" :).

well, this is no real solution, since the could be a
situation were you have to backslashes and then
you will have three there.
No, that's precisely the solution. To represent a literal backslash in
RTF, you need to use the double-backslash escape, @"\\". If the source
code has two backslashes, a plain replace will never yield three - you
will have four (and the RichTextBox will correspondingly show those as
two literal backslashes).

Aug 29 '08 #6
Hi,

thnaks for the reply. Well thats what i also found out.
The RTF Docs made this clear and my conclusion here
is, that i have to work with regular expressions to replace
everything that can be "collide" with RTF Control Codes.

Well, this is also no 100% solution, but the best so
far,...

Thanks for all the Answers,...

Regards

Kerem

--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Latest Project: http://www.codeplex.com/restarts
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."

"Pavel Minaev" <in****@gmail.comschrieb im Newsbeitrag
news:da**********************************@59g2000h sb.googlegroups.com...
On Aug 29, 3:47 am, Kerem Gümrükcü <kareem...@hotmail.comwrote:
Hi Caio,
Just replace each backslash to *two* backslashes, as >do in C# when you
don't use the "@" :).

well, this is no real solution, since the could be a
situation were you have to backslashes and then
you will have three there.
No, that's precisely the solution. To represent a literal backslash in
RTF, you need to use the double-backslash escape, @"\\". If the source
code has two backslashes, a plain replace will never yield three - you
will have four (and the RichTextBox will correspondingly show those as
two literal backslashes).

Aug 29 '08 #7
Hi Kerem,

I don't get it when you say this is not a 100% solution... This is the only
solution! :)

If you do a simple test, and set the Text property of a RichTextBox including
RTF Control Codes such as "\", and then check the Rtf property, you will
notice that the RichTextBox control duplicate the control codes...

Cheers,

--
Caio Proiete
http://www.caioproiete.com
-
Hi,

thnaks for the reply. Well thats what i also found out.
The RTF Docs made this clear and my conclusion here
is, that i have to work with regular expressions to replace
everything that can be "collide" with RTF Control Codes.
Well, this is also no 100% solution, but the best so far,...

Thanks for all the Answers,...

Regards

Kerem

"Pavel Minaev" <in****@gmail.comschrieb im Newsbeitrag
news:da**********************************@59g2000h sb.googlegroups.com.
.. On Aug 29, 3:47 am, Kerem Gümrükcü <kareem...@hotmail.comwrote:
>Hi Caio,
>>Just replace each backslash to *two* backslashes, as >do in C# when
you don't use the "@" :).
well, this is no real solution, since the could be a
situation were you have to backslashes and then
you will have three there.
No, that's precisely the solution. To represent a literal backslash in
RTF, you need to use the double-backslash escape, @"\\". If the source
code has two backslashes, a plain replace will never yield three - you
will have four (and the RichTextBox will correspondingly show those as
two literal backslashes).

Aug 29 '08 #8
Hi Caio,
>I don't get it when you say this is not a 100% solution... This is the only
solution! :)
yes it is and i am not saticfied with RTF anylonger so thats why
i use a GDI(+) solution. It was a wrong decision to use RTF,
because i needed several Graphics Operations that could not
be done with RTF, better to say redered,...

Thanks for you reply,...
Regards

Kerem.
--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Latest Project: http://www.codeplex.com/restarts
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
"Caio Proiete [MCT]" <ca***************@proiete.comschrieb im Newsbeitrag
news:c6************************@msnews.microsoft.c om...
Hi Kerem,

I don't get it when you say this is not a 100% solution... This is the
only solution! :)

If you do a simple test, and set the Text property of a RichTextBox
including RTF Control Codes such as "\", and then check the Rtf property,
you will notice that the RichTextBox control duplicate the control
codes...

Cheers,

--
Caio Proiete
http://www.caioproiete.com
-
>Hi,

thnaks for the reply. Well thats what i also found out.
The RTF Docs made this clear and my conclusion here
is, that i have to work with regular expressions to replace
everything that can be "collide" with RTF Control Codes.
Well, this is also no 100% solution, but the best so far,...

Thanks for all the Answers,...

Regards

Kerem

"Pavel Minaev" <in****@gmail.comschrieb im Newsbeitrag
news:da**********************************@59g2000 hsb.googlegroups.com.
.. On Aug 29, 3:47 am, Kerem Gümrükcü <kareem...@hotmail.comwrote:
>>Hi Caio,

Just replace each backslash to *two* backslashes, as >do in C# when
you don't use the "@" :).

well, this is no real solution, since the could be a
situation were you have to backslashes and then
you will have three there.
No, that's precisely the solution. To represent a literal backslash in
RTF, you need to use the double-backslash escape, @"\\". If the source
code has two backslashes, a plain replace will never yield three - you
will have four (and the RichTextBox will correspondingly show those as
two literal backslashes).

Aug 29 '08 #9
Oh, okay :).

--
Caio Proiete
http://www.caioproiete.com
-
Hi Caio,
>I don't get it when you say this is not a 100% solution... This is
the only solution! :)
yes it is and i am not saticfied with RTF anylonger so thats why
i use a GDI(+) solution. It was a wrong decision to use RTF,
because i needed several Graphics Operations that could not
be done with RTF, better to say redered,...
Thanks for you reply,...

Regards

Kerem.

Aug 29 '08 #10
On Aug 30, 2:37*am, Kerem Gümrükcü <kareem...@hotmail.comwrote:
Hi Caio,
I don't get it when you say this is not a 100% solution... This is the only
solution! :)

yes it is and i am not saticfied with RTF anylonger so thats why
i use a GDI(+) solution. It was a wrong decision to use RTF,
because i needed several Graphics Operations that could not
be done with RTF, better to say redered,...

Thanks for you reply,...
If you have some reasonably complicated text layout with inline vector
graphics, and you do not mind a dependency on 3.0, consider hosting
the WPF FlowDocument control inside your WinForms application.
Aug 31 '08 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Wynter | last post by:
RE: from Displaying a Document using the ASPNET user account to the Client Browser discussion (3/2/2004 Buddy Thanks for helping me on getting the document to display. But now I am left with a...
1
by: Yoshitha | last post by:
hi I have datalist control in my ASP.NET application the problem here is i have used a textbox with multiline true propertly when i enter data like "fdjsfhjksdhfjsdfhsdjhfsdfhsdjfhsd...
2
by: Susan Bricker | last post by:
Greetings! Still the same application (as previous posts). I worked on the app while at work (don't tell my boss ... cause this is just for fun and not work related) and the form was working,...
5
by: Tomaz Koritnik | last post by:
Hi I have many short HTML files stored in a binary stream storage to display descriptions for various items in application. HTML would be display inside application using some .NET control or...
0
by: Earl Teigrob | last post by:
I can create a new custom control (and not change it) and add it to the toolbox and drag it onto the disign screen and it works just fine, displaying the text . However, when I add the following...
9
by: Eric Lindsay | last post by:
I can't figure how to best display little snippets of shell script using <pre>. I just got around to organising to bulk validate some of my web pages, and one of the problems occurs with Bash...
10
by: gnewsgroup | last post by:
I've googled and tried various approaches, but could not resolve this problem. The article at MSDN: Displaying Images in a GridView Column only presents a simple case where all data (including the...
1
by: seanh | last post by:
Hello, I am having problems on displaying deep node elements <DDD> and <EEE> using a stylesheet to display it in html. In the ouput that I am trying to get (the part with the (******) below) is...
10
by: =?iso-8859-1?B?S2VyZW0gR/xtcvxrY/w=?= | last post by:
Hi, i have text like this: "ACPI\GENUINEINTEL_-_X86_FAMILY_6_MODEL_13\_0" an after displaying it in a RichTextBox as RTF string, i get this: "ACPI_-_x86_Family_6_Model_13 "
7
by: RichB | last post by:
I am trying to get to grips with the asp.net ajaxcontrol toolkit, and am trying to add a tabbed control to the page. I have no problems within the aspx file, and can dynamically manipulate a...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.