Hey,
i want my program to write text from a RichTextBox to the hosts.-file to block some sites. My problem is now that my code doesn't recognize a new line I have made in the RichTextBox. It writes the text in the hosts.-file like this:
"127.0.0.1 www.virustotal.com127.0.0.1 www.eset.com127.0.0.1 www.avast.com"
blockedwww = RichTextBox.Text
If you know how I can fix that, I really appreciate your help!
Best regards
i want my program to write text from a RichTextBox to the hosts.-file to block some sites. My problem is now that my code doesn't recognize a new line I have made in the RichTextBox. It writes the text in the hosts.-file like this:
"127.0.0.1 www.virustotal.com127.0.0.1 www.eset.com127.0.0.1 www.avast.com"
Code
Dim Hosts As String = Environment.SystemDirectory & "\drivers\etc\hosts"
Dim sr As New StreamReader(Hosts)
Dim input As String = sr.ReadToEnd()
sr.Close()
Dim output As String = input & vbNewLine & blockedwww
output.Replace(vbLf, vbNewLine)
Dim sw As New StreamWriter(Hosts)
sw.Write(output)
sw.Close()blockedwww = RichTextBox.Text
If you know how I can fix that, I really appreciate your help!
Best regards

