How can I detect new line from string. I tried Environment.NewLine but its not working. Initially I tried to replace it directly but it was not working after I tried to detect new line. Then I came to know that its not detecting new line.

As temporary solution I have taken a richbox with new line and comparing it. Its working fine but its not the proper method so please tell me how to do it properly.

The richtextbox uses chr(10) (VBLf) to designate a new line. So if that is working, then check for VBLf (this is a VB character constant).

On non-Unix systems, the System.Environment.NewLine is a two character string equivalent to chr(13) & chr(10). You could also use the VB constant VBCrLf for this.

What is it that you are trying to accomplish? There are most likely other methods that could be suggested.

The text file with this post has one line of text and a newline. You can use either VBCRLF or VBNEWLINE

 Dim txt As String = My.Computer.FileSystem.ReadAllText(My.Computer.FileSystem.SpecialDirectories.Desktop & "\newLine.txt")

 If txt.Contains(vbNewLine) Then
        End If

@TnTinMN I was trying to remove new lines from string before inserting it to array list. I tried chr(13) and chr(10) its not working, but VBCrLf is working. thnx

@kRod it works ;) thnx