473,320 Members | 2,012 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,320 software developers and data experts.

Strange Behaviour with MultiLine Textbox Control

I am developing an app in VS2005 (actually in VB.NET but this
question, I believe, would apply to any .NET language) that is used to
design the contents of an XML file. One of potential items that would
be in this XML file is a String property that contains the code for a
VBScript. I have a separate form just for editing this script that
uses a single Textbox. This Textbox has the AcceptsReturn, AcceptsTab
and Multiline properties all set to True. I can create a new script
just fine and save it in the XML file. But if I re-load that XML file
for editing, and open the form with the contents of the script from
the XML file in it, all carraige returns are ignored. Oh, they are
definitely there, if you look at the XML file file with a hex editor,
there are definite <CR><LFat the end of each of the scripts lines.
What is really strange is if I create a new script and re-edit it
before saving the XML and re-loading it, the carraige returns are
"displayed" in the Textbox as one would expect.

As I said, the XML file is fine. The problem come in when trying to
edit an existing script that has carraige returns in it.

Jun 21 '07 #1
2 1794
On Jun 21, 10:12 am, z...@construction-imaging.com wrote:
I am developing an app in VS2005 (actually in VB.NET but this
question, I believe, would apply to any .NET language) that is used to
design the contents of an XML file. One of potential items that would
be in this XML file is a String property that contains the code for a
VBScript. I have a separate form just for editing this script that
uses a single Textbox. This Textbox has the AcceptsReturn, AcceptsTab
and Multiline properties all set to True. I can create a new script
just fine and save it in the XML file. But if I re-load that XML file
for editing, and open the form with the contents of the script from
the XML file in it, all carraige returns are ignored. Oh, they are
definitely there, if you look at the XML file file with a hex editor,
there are definite <CR><LFat the end of each of the scripts lines.
What is really strange is if I create a new script and re-edit it
before saving the XML and re-loading it, the carraige returns are
"displayed" in the Textbox as one would expect.

As I said, the XML file is fine. The problem come in when trying to
edit an existing script that has carraige returns in it.
Sorry for the waste of bandwidth, but I just figured this out. The XML
file being edited is loaded and written using the XMLSerializer class.
For some strange reason, when I de-serialize the XML file, any string
value that contains embedded <CR><LF>, all occurances of them are
replaced with a <LFonly. But when the class is serialized, the <LF>
are then replaced by <CR><LF>!!! I wonder why?

Anyway, the problem was solved by adding a .Replace(vbLf, vbCrLf) as
the text box .Text property was loaded.

Jun 21 '07 #2
strange
Windows ( DOS ) based systems uses two characters (carriage-return and
line-feed), to signal the end of a line, while UNIX based systems uses only
one (line-feed).

As .Net ( and especially the XML / webservices ) is platform independend i
guess some conversion routine doesn`t work as expected


regards

Michel


"za***@construction-imaging.com" wrote:
On Jun 21, 10:12 am, z...@construction-imaging.com wrote:
I am developing an app in VS2005 (actually in VB.NET but this
question, I believe, would apply to any .NET language) that is used to
design the contents of an XML file. One of potential items that would
be in this XML file is a String property that contains the code for a
VBScript. I have a separate form just for editing this script that
uses a single Textbox. This Textbox has the AcceptsReturn, AcceptsTab
and Multiline properties all set to True. I can create a new script
just fine and save it in the XML file. But if I re-load that XML file
for editing, and open the form with the contents of the script from
the XML file in it, all carraige returns are ignored. Oh, they are
definitely there, if you look at the XML file file with a hex editor,
there are definite <CR><LFat the end of each of the scripts lines.
What is really strange is if I create a new script and re-edit it
before saving the XML and re-loading it, the carraige returns are
"displayed" in the Textbox as one would expect.

As I said, the XML file is fine. The problem come in when trying to
edit an existing script that has carraige returns in it.

Sorry for the waste of bandwidth, but I just figured this out. The XML
file being edited is loaded and written using the XMLSerializer class.
For some strange reason, when I de-serialize the XML file, any string
value that contains embedded <CR><LF>, all occurances of them are
replaced with a <LFonly. But when the class is serialized, the <LF>
are then replaced by <CR><LF>!!! I wonder why?

Anyway, the problem was solved by adding a .Replace(vbLf, vbCrLf) as
the text box .Text property was loaded.

Jun 22 '07 #3

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

Similar topics

0
by: Dot net work | last post by:
Hi, Make up a very simple project as follows: 1 aspx form 3 web user controls (referred to as A, B, and C) "A" web user control: Put 1 textbox and 1 button on this web user control. (You...
8
by: David | last post by:
This is something I had never seen before. On an aspx page, upon pressing a link button for which I have an event handler in the code behind, the screen shows nothing but a line that says "true"...
0
by: the friendly display name | last post by:
Hi, I have a filled multiline textbox on the site. I can scroll it with IE and Firefox, but under Opera (tested under 7.54, and Opera 8, under "identify as MSIE" and under Opera identification)...
2
by: Pieter | last post by:
Hi, Using this Multiline Combobox(http://www.vbcity.com/forums/faq.asp?fid=15&cat=ListBox%2FComboBox#TID58434), doesn't allow the user to type multi line text in the texbox-part of the...
2
by: Mike | last post by:
I am trying to write a little program for my own use using VB2005 express edition. I have a list of peoples names in a file that I read into an array of strings. I am using a multiline textbox to...
2
by: zacks | last post by:
I am developing an app in VS2005 (actually in VB.NET but this question, I believe, would apply to any .NET language) that is used to design the contents of an XML file. One of potential items that...
7
by: Anil Gupte | last post by:
I have read a lot about getting lines from a multiline textbox in VB.Net. However, I cannot for the life of me figure out how to write to a multiline textbox. Basically, I have created an array of...
2
by: Nathan Sokalski | last post by:
I have a multiline TextBox that I want to display the text used to create a control in an apsx file. I want each of these to be on a separate line in the TextBox. The only way I know of to place...
2
by: sirdavethebrave | last post by:
Hi guys - I have written a form, and a stored procedure to update the said form. It really is as simple as that. A user can go into the form, update some fields and hit the update button to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.