c# - New Line Character is not shown in TextBox -


i have form shown in image below:

enter image description here

now, when user clicks on save template, save text of textbox in xml file. code use save text in xml file :

public static void savetemplate(string message) {     xdocument xmldocument = xdocument.load(templatespath);      xmldocument.element("templates").add(         new xelement("template", new xattribute("id", xmldocument.root.elements("template").lastordefault() != null ? int.parse(xmldocument.root.elements("template").lastordefault().attribute("id").value) + 1 : 1),             new xelement("body", message)));      xmldocument.save(templatespath); } 

the text saved in xml file looks like:

enter image description here

after user may whatever wants. when user runs application again, textbox empty. so, click on load template button. @ time text shown in datagridview:

enter image description here

now, user clicks on select template , text datagridviewcell copied textbox again. text not contain new lines. @ image below:

enter image description here

does experienced same problem in past?

i had replace \n environment.newlinelike:

_frmmsgdetails.messagebody = dgvtemplates.selectedrows[0].cells[2].value.tostring()                                                 .replace("\n", environment.newline); 

Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -