PDA

View Full Version : سوال: کد برای سیو از کرفتن از لینک



vikings
چهارشنبه 06 شهریور 1392, 11:28 صبح
یه کد میخواستم که هر 2 دقیقه بره از یه لینکی سیو از بگیره و بزاره جای سیو از قبلی

bitasoft.ir
سه شنبه 12 شهریور 1392, 20:58 عصر
یه کد میخواستم که هر 2 دقیقه بره از یه لینکی سیو از بگیره و بزاره جای سیو از قبلی

سلام
اول یه تایمر مزارین و زمانش رو روی چهار دقیقه تنظیم می کنین. بعد هر بار داخل اون تایمر باید بگین این متد رو Call کنه:



Dim Str As System.IO.Stream
Dim srRead As System.IO.StreamReader
Try
' make a Web request
Dim req As System.Net.WebRequest = System.Net.WebRequest.Create("http://www.YourSite.com/")
Dim resp As System.Net.WebResponse = req.GetResponse
StR = resp.GetResponseStream
srRead = New System.IO.StreamReader(Str)
' read all the text
RichTextBox1.Text = srRead.ReadToEnd
Catch ex As Exception
RichTextBox1.Text = "Unable to download content"
Finally
' Close Stream and StreamReader when done
srRead.Close()
Str.Close()
End Try