Linefeed in Datacolumn.Expression

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello ng

I edit the field expression with '\n' or '\r\n' in the property-designer of
the dataset/datacolumn. At runtime in the datagrid I miss the linebreak. The
charaters '\n' or '\r\n' were shown in the datagrid.

How can I include a linebreak in the Datacolumn.Expression from a typed
dataset?

I hope you can help me!
 
Hi,
I assume you are using Visual Studio 2005, if I have misunderstood anything
here please let me know.

In ADO.net 2.0, the typed dataset in design mode will automatically convert
the character('\r''\n' '\t' ) to "\\r", "\\n" and "\\t". For this reason,
if you typed '\n' into field expression of dataset/datacolumn on design
mode, the character will be converted to "\\n" and shown "\n" in datagrid.

However, you can modify such character manual. In dataset.designer.cs file,
you can search the string "\\n" and change this to "\n" by yourself. But,
notice, this file is generated by Visual Studio, each time you make any
change in dataset.xsd file. Visual Studio will generate designer.cs file
again. This means, you should have to modify string "\\n" again.

But, unfortunately, I'm afraid DataGridView will not show a new line for
you. Under my test, all the characters ('\n','\t','\r'...) will be deleted
by DataGridView. I think this is DataGridView's behavior.
For example: The string "line1 \r\nline2 \r\nline3" will be shown in
DataGridView as "line1 line2 line3"

If you have anything unclear or concern, please feel free to update here.We
will follow up. I'm glad to assist you.
Have a great day,
Sincerely,
Wen Yuan
 
Hi,

I haven't heard from you two days,
Just want to check whether there is anything we can help with.

Please feel free to update here. I'm glad to assist you.
Have a great day,
Sincerely,
Wen Yuan
 
Back
Top