473,387 Members | 1,890 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,387 software developers and data experts.

Richtext control characters "@"

Lee
Hi,

When reading a number richtext strings back from a database c# adds
the @ operator to the string, the effect being all the control
characters are ignored and the string cannot be added to a richtextbox.
I'm using a stored procedure to get the data and the data type is
varchar in the database and stored procedure.

Any assistance on suppress c# from adding the @ operator would be much
appreciated. Code shown below:

Thanks
Lee

SqlCommand sqlComm = new SqlCommand();
SqlDataReader sqlData = null;

sqlData = sqlComm.ExecuteReader ();

/ Obtain all the data.
while (sqlData.Read())
{
if (sqlData["Text"] != DBNull.Value)
{
m_text = sqlData["Text"].ToString(); // m_text has @
preceeding the string.
}
}

Nov 27 '06 #1
2 1879
Hi,

C# isn't adding anything to your strings.

In the debugger, you may see the verbatim literal string character, @, added
outside of the string. That @ character tells C# (and the debugger) to
ignore escape sequences in the string that follows, such as, \n, instead of
processing them.

The value of your m_text variable is what was retrieved from
sqlData["Text"].ToString() regardless of the way it's being presented to you
in the debugger.

--
Dave Sexton

"Lee" <le*******@handbag.comwrote in message
news:11*********************@45g2000cws.googlegrou ps.com...
Hi,

When reading a number richtext strings back from a database c# adds
the @ operator to the string, the effect being all the control
characters are ignored and the string cannot be added to a richtextbox.
I'm using a stored procedure to get the data and the data type is
varchar in the database and stored procedure.

Any assistance on suppress c# from adding the @ operator would be much
appreciated. Code shown below:

Thanks
Lee

SqlCommand sqlComm = new SqlCommand();
SqlDataReader sqlData = null;

sqlData = sqlComm.ExecuteReader ();

/ Obtain all the data.
while (sqlData.Read())
{
if (sqlData["Text"] != DBNull.Value)
{
m_text = sqlData["Text"].ToString(); // m_text has @
preceeding the string.
}
}

Nov 27 '06 #2
Lee <le*******@handbag.comwrote:
When reading a number richtext strings back from a database c# adds
the @ operator to the string, the effect being all the control
characters are ignored and the string cannot be added to a richtextbox.
No, it doesn't. What you're seeing is the debugger trying to help you.

See http://www.pobox.com/~skeet/csharp/s....html#debugger

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Nov 27 '06 #3

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

Similar topics

0
by: Jason Xu | last post by:
Hello, I am working on printing richtext with C# by sending EM_FORMATRANGE message to the underlying richedit control. I can set the text format by sending EM_SETPARAFORMAT message now. However,...
1
by: Pete Griffint | last post by:
Howdy! I want to get the following in a Richtext control: Paragraph 1.... Paragraph 2... Obviously I want to do something like rtb.SelectedText="Paragraph 1...";...
0
by: Lukas Thanei | last post by:
Hi, Im trying for 2 days to solve a problem but now Im on a point where all ideas exhausted. Im writing a software to print out some cards containing richtext and images. To print the...
3
by: tlyczko | last post by:
I have Stephen Lebans' RichText control on a subform, which is bound to a memo field. The only editable control on this subform is the rich text control for the memo field. When the main form...
11
by: Ron L | last post by:
I have a barcode scanner which uses a "keyboard wedge" program so that the data it scans comes through as if it was typed on a keyboard. I am trying to have the data in the barcode be displayed in...
6
by: Tomo | last post by:
How to use RichText in ASP.NET application. I need to make web page where user can write some text, click save and than this content must be saved as html content. Can I find some richtext control...
0
by: giddy | last post by:
hi , i made a little RtfEncapsulator. Its a class thats called RichText , it has an RtfElementCollection which takes any class that exposes the IRtfElement interface. I managed to make an...
3
by: Soulless | last post by:
Hi, I am going crazy trying to resolve a stupid issue. I have a RTB control and created a method to accept a string and (hopefully) set the font and size and alignment... Here is the method: ...
4
by: Pubs | last post by:
Hi all, I have application being written in C# where I have to calculate the text pixel height and width of the line being typed in rich text box. I need to get the pixel height of the character...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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,...

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.