Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Download file .Net -> VB

[es] :: .NET :: Download file .Net -> VB

[ Pregleda: 1177 | Odgovora: 1 ]

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

icobh
Igor Pejašinović
PEJAŠINOVIĆ LTD.
Stara Dubrava, RS, BiH

Član broj: 18738
Poruke: 1171
*.teol.net

Sajt: localhost


Profil

icon Download file .Net -> VB10.04.2004. u 19:47

Ljudi ovo bi trebao biti kod za skidanje sa određene stranice fajl. Kod je napisan u vb.net a meni treba u VB.Pa bih molio nekog da to prevede ili ako neko zna takav primjer za VB.Evo koda:
Code:

vbc /r:System.Net.dll /r:System.IO.dll webretrieve.vb

Source Code 

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


Class WebRetrieve

Public Shared Sub Main()
Dim wr As HttpWebRequest = CType(WebRequestFactory.Create("http://maps.weather.com/
 web/radar/us_orl_ultraradar_large_usen.jpg"), HttpWebRequest)
Dim ws As HttpWebResponse = CType(wr.GetResponse(), HttpWebResponse)
Dim str As Stream = ws.GetResponseStream()
Dim inBuf(100000) As Byte
Dim bytesToRead As Integer = CInt(inBuf.Length)
Dim bytesRead As Integer = 0
While bytesToRead > 0
Dim n As Integer = str.Read(inBuf, bytesRead, bytesToRead)
If n = 0 Then
Exit While
End If
bytesRead += n
bytesToRead -= n
End While
Dim fstr As New FileStream("weather.jpg", FileMode.OpenOrCreate, FileAccess.Write)
fstr.Write(inBuf, 0, bytesRead)
str.Close()
fstr.Close()
End Sub 'Main
End Class 'WebRetrieve 

I ♥ ♀

Ovaj post je zlata vrijedan!
10.04.2004. u 19:47 

mmix
Miljan Mitrovic
Software Architect
Pancevo, Srbija

SuperModerator
Član broj: 17944
Poruke: 2407
193.203.9.*



Profil

icon Re: Download file .Net -> VB11.04.2004. u 13:08
Ekvivalentan učinak preko COMa možeš dobiti upotrebom IXmlHttpRequest interfejsa iz msxml2+ biblioteke (ide uz IE)

Code:

Dim HttpReq As New MSXML2.XMLHTTP40
  
HttpReq.open "GET", "http://XMLSampleServer/CatalogServer.asp", False
HttpReq.send


Za detalje o ovom pogledaj msdn:
http://msdn.microsoft.com/libr...l_obj_ixmlhttprequest_741g.asp

Iako je ovaj objekat namenjen skidanju/slanju XMLova na web server, našao je svoju primenu u load-on-demand i post-on-demand scenarijima za bilo koji oblik podataka.
▪ The quicker a phone is answered in sales, the slower it's answered in customer services - Brownridge's Law
▪ Democracy is a device that ensures we shall be governed no better than we deserve - George Bernard Shaw
▪ To err is human--and to blame it on a computer is even more so - Robert Orben
11.04.2004. u 13:08 

[es] :: .NET :: Download file .Net -> VB

[ Pregleda: 1177 | Odgovora: 1 ]

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.