How To Read A Text File Hosted Online To A String

 How To Read A TXT File Hosted Online To A String
So I got a email asking how to do this, I haven't done this before so went through some Google searches and found how to do this. It was pretty easy. I'll just share the code here maybe it'll be useful for someone.

You need these namespaces :
Imports System.IO
Imports System.Net

Event :
Dim TXT As String = "http://www.ultimateprogrammingtutorials.info/robots.txt"
Dim WC As WebClient = New WebClient()
Dim Read As StreamReader = New StreamReader(WC.OpenRead(TXT))
Dim STR As String = Read.ReadToEnd
TextBox1.Text = STR

  • Replace the TXT string value with your .txt link. 
  • You can also write into a richtextbox or whatever you want(I used textbox1 for example) 
I hope you learned something from this snippet.