Solved

unix2dos with .net

Posted on 2013-01-23
5
345 Views
Last Modified: 2013-01-23
I have some code that is getting output from a Linux script and I display it in a textbox.  How can I convert this to display correctly on my screen?  I would like to do this without having to write the file out.  Can I do a unix2dos conversion in .net?
0
Comment
Question by:chadmanvb
5 Comments
 
LVL 42

Expert Comment

by:sedgwick
ID: 38809751
can u post an example?
0
 

Author Comment

by:chadmanvb
ID: 38809911
When I display the output into a text box it does not see the correct line breaks.  It looks and shows up as one long line. It should only show 2 lines and line up the columns.
0
 
LVL 35

Accepted Solution

by:
Robert Schutt earned 500 total points
ID: 38809922
The problem with this usually is in the different line endings. To convert the unix 'linefeed-only' to the dos/windows 'cr/lf' you can use:
TextBox1.Text = strUnixText.Replace(vbLf, vbCrLf)

Open in new window

0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 38809973
Also, set the Multiline property of textbox to true and increase its height.
0
 

Author Closing Comment

by:chadmanvb
ID: 38810234
That did it!  Thanks.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Latest thoughts on C# utilizing Mono on Linux vs .NET on Windows? 5 66
JSON  parse help 7 40
FInd Image Control Gridview 3 23
Access/Visual Basic Question 3 29
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question