Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vb.net read text from web .txt file and show it in textbox?

Tags:

.net

vb.net

I am trying to read few number from internet .txt file and show it in text box, but without result...

These systems are imported:

Imports System.IO
Imports System.Text
Imports System.Net

Here is the code of reading file:

Dim address As String = "http://www.url.com/text.txt"
Dim client As WebClient = New WebClient()
Dim reply As String = client.DownloadString(address)
TextBox2.Text = reply
like image 577
Chelovek Avatar asked May 20 '13 18:05

Chelovek


1 Answers

Try this instead:

Dim address As String = "http://www.stackoverflow.com"
Dim client As WebClient = New WebClient()
Dim reader As StreamReader = New StreamReader(client.OpenRead(address))
Textbox2.Text = reader.ReadToEnd
like image 58
maxedev Avatar answered Sep 22 '22 19:09

maxedev