I am trying to read a multiple line notepad document and display the text in a multiline text box.
Here is the code I am using:
Dim messageString As String = My.Computer.FileSystem.ReadAllText(c:\test123.txt).ToString
infoTextBox.Text = messageString
Unfortunatly if the notepad document has multiple lines it shows as a black square character at the end of each line. It then displays that black character in the text box instead of creating a new line. When I debug and step through the code and copy the black box from the messageString variable and then paste it into a text editor or even visual studio it creates a line!
Any help would be greatly appreciated.
Thanks,
Nathan
using readalltext in visual studio
Moderator: Dictators in Training
Translate every char into its ascii char value, then when it gets to the little black box, if its no the correct value for a carriage return, replace it. Probably wont work, but its worth a try.
For to win one hundred victories in one hundred battles is not the acme of skill. To subdue the enemy without fighting is the acme of skill.
I found out the problem.
The code above actually works. The reason I was having trouble is because I also tried to save the information to SQL server. After doing what you said, I noticed that the carriage returns where not being saved on SQL. Only the line feeds.
I found this code to add in the carriage returns after saving to a sql server. vbLf and vbCrLf are constants in vb.net
messageString = Replace(messageString, vbLf, vbCrLf)
The code above actually works. The reason I was having trouble is because I also tried to save the information to SQL server. After doing what you said, I noticed that the carriage returns where not being saved on SQL. Only the line feeds.
I found this code to add in the carriage returns after saving to a sql server. vbLf and vbCrLf are constants in vb.net
messageString = Replace(messageString, vbLf, vbCrLf)
Maeya wrote:And then your head just aches from having your hair pulled so tight for so long...

