Ok, it workes now...
just download that example from c#.
Then use webdownload.dll and add it to your vb file refferences...
copy all forms boxes from c# to vb.net
and copy this code
Imports System
Imports System.Drawing
Imports System.Collecti ons
Imports System.Componen tModel
Imports System.Windows. Forms
Imports RJH.Utils.WebDo wnload
Public Class WebDownloadForm
Inherits System.Windows. Forms.Form
Private downloadUrlText Box As System.Windows. Forms.TextBox
Private urlLabel As System.Windows. Forms.Label
Private outputGroupBox As System.Windows. Forms.GroupBox
Private downloadBtn As System.Windows. Forms.Button
Private downloadProgres sLbl As System.Windows. Forms.Label
Private bytesDownloaded Lbl As System.Windows. Forms.Label
Private totalBytesLbl As System.Windows. Forms.Label
Private bytesDownloaded TextBox As
System.Windows. Forms.TextBox
Private totalBytesTextB ox As System.Windows. Forms.TextBox
Private progressBar As System.Windows. Forms.ProgressB ar
Private components As System.Componen tModel.Containe r =
Nothing
Public Sub New()
InitializeCompo nent()
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing
As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Disp ose()
End If
End If
MyBase.Dispose( disposing)
End Sub
Private Sub InitializeCompo nent()
Me.downloadUrlT extBox = New System.Windows. Forms.TextBox
Me.urlLabel = New System.Windows. Forms.Label
Me.outputGroupB ox = New System.Windows. Forms.GroupBox
Me.downloadBtn = New System.Windows. Forms.Button
Me.progressBar = New System.Windows. Forms.ProgressB ar
Me.downloadProg ressLbl = New System.Windows. Forms.Label
Me.bytesDownloa dedLbl = New System.Windows. Forms.Label
Me.totalBytesLb l = New System.Windows. Forms.Label
Me.bytesDownloa dedTextBox = New
System.Windows. Forms.TextBox
Me.totalBytesTe xtBox = New System.Windows. Forms.TextBox
Me.outputGroupB ox.SuspendLayou t()
Me.SuspendLayou t()
Me.downloadUrlT extBox.Location = New
System.Drawing. Point(128, 16)
Me.downloadUrlT extBox.Name =
"downloadUrlTex tBox"
Me.downloadUrlT extBox.Size = New
System.Drawing. Size(280, 20)
Me.downloadUrlT extBox.TabIndex = 0
Me.downloadUrlT extBox.Text = ""
Me.urlLabel.Loc ation = New System.Drawing. Point(16,
20)
Me.urlLabel.Nam e = "urlLabel"
Me.urlLabel.Siz e = New System.Drawing. Size(100,
16)
Me.urlLabel.Tab Index = 1
Me.urlLabel.Tex t = "File To Download :"
Me.outputGroupB ox.Controls.Add Range(New
System.Windows. Forms.Control() {Me.totalBytesT extBox,
Me.bytesDownloa dedTextBox, Me.bytesDownloa dedLbl,
Me.downloadProg ressLbl, Me.progressBar, Me.totalBytesLb l})
Me.outputGroupB ox.Enabled = False
Me.outputGroupB ox.Location = New
System.Drawing. Point(8, 48)
Me.outputGroupB ox.Name = "outputGroupBox "
Me.outputGroupB ox.Size = New System.Drawing. Size(504,
120)
Me.outputGroupB ox.TabIndex = 2
Me.outputGroupB ox.TabStop = False
Me.outputGroupB ox.Text = "Output and Callbacks"
Me.downloadBtn. Location = New
System.Drawing. Point(416, 16)
Me.downloadBtn. Name = "downloadBt n"
Me.downloadBtn. Size = New System.Drawing. Size(88,
23)
Me.downloadBtn. TabIndex = 3
Me.downloadBtn. Text = "Download"
AddHandler Me.downloadBtn. Click, AddressOf
Me.downloadBtn_ Click
Me.progressBar. Location = New
System.Drawing. Point(120, 88)
Me.progressBar. Name = "progressBa r"
Me.progressBar. Size = New System.Drawing. Size(376,
23)
Me.progressBar. TabIndex = 0
Me.downloadProg ressLbl.Locatio n = New
System.Drawing. Point(16, 88)
Me.downloadProg ressLbl.Name =
"downloadProgre ssLbl"
Me.downloadProg ressLbl.Size = New
System.Drawing. Size(104, 23)
Me.downloadProg ressLbl.TabInde x = 1
Me.downloadProg ressLbl.Text = "Download
Progress"
Me.bytesDownloa dedLbl.Location = New
System.Drawing. Point(16, 28)
Me.bytesDownloa dedLbl.Name =
"bytesDownloade dLbl"
Me.bytesDownloa dedLbl.TabIndex = 2
Me.bytesDownloa dedLbl.Text = "Bytes Downloaded"
Me.totalBytesLb l.Location = New
System.Drawing. Point(16, 60)
Me.totalBytesLb l.Name = "totalBytes Lbl"
Me.totalBytesLb l.TabIndex = 2
Me.totalBytesLb l.Text = "Total Bytes"
Me.bytesDownloa dedTextBox.Loca tion = New
System.Drawing. Point(120, 24)
Me.bytesDownloa dedTextBox.Name =
"bytesDownloade dTextBox"
Me.bytesDownloa dedTextBox.Read Only = True
Me.bytesDownloa dedTextBox.Size = New
System.Drawing. Size(168, 20)
Me.bytesDownloa dedTextBox.TabI ndex = 3
Me.bytesDownloa dedTextBox.Text = ""
Me.bytesDownloa dedTextBox.Text Align =
System.Windows. Forms.Horizonta lAlignment.Cent er
Me.totalBytesTe xtBox.Location = New
System.Drawing. Point(120, 56)
Me.totalBytesTe xtBox.Name = "totalBytesText Box"
Me.totalBytesTe xtBox.ReadOnly = True
Me.totalBytesTe xtBox.Size = New
System.Drawing. Size(168, 20)
Me.totalBytesTe xtBox.TabIndex = 4
Me.totalBytesTe xtBox.Text = ""
Me.totalBytesTe xtBox.TextAlign =
System.Windows. Forms.Horizonta lAlignment.Cent er
Me.AutoScaleBas eSize = New System.Drawing. Size(5,
13)
Me.ClientSize = New System.Drawing. Size(520, 175)
Me.Controls.Add Range(New
System.Windows. Forms.Control() {Me.downloadBtn ,
Me.outputGroupB ox, Me.urlLabel, Me.downloadUrlT extBox})
Me.FormBorderSt yle =
System.Windows. Forms.FormBorde rStyle.FixedDia log
Me.Name = "WebDownloadFor m"
Me.Text = "WebDownloa d Tester"
Me.outputGroupB ox.ResumeLayout (False)
Me.ResumeLayout (False)
End Sub
<STAThread()> _
Shared Sub Main()
Application.Run (New WebDownloadForm )
End Sub
Private Sub DownloadProgres sCallback(ByVal bytesSoFar As
Integer, ByVal totalBytes As Integer)
bytesDownloaded TextBox.Text =
bytesSoFar.ToSt ring("#,##0")
If Not (totalBytes = -1) Then
progressBar.Min imum = 0
progressBar.Max imum = totalBytes
progressBar.Val ue = bytesSoFar
totalBytesTextB ox.Text =
totalBytes.ToSt ring("#,##0")
Else
progressBar.Vis ible = False
totalBytesTextB ox.Text = "Total File Size Not
Known"
End If
End Sub
Private Sub DownloadComplet eCallback(ByVal dataDownloaded
As Byte())
If Not progressBar.Vis ible Then
progressBar.Vis ible = True
progressBar.Min imum = 0
progressBar.Val ue = progressBar.Max imum = 1
totalBytesTextB ox.Text = bytesDownloaded TextBox.Text
End If
MessageBox.Show ("Download complete...",
"Download Info")
End Sub
Private Sub downloadBtn_Cli ck(ByVal sender As Object,
ByVal e As System.EventArg s)
If Not (Me.downloadUrl TextBox.Text = "")
Then
Me.outputGroupB ox.Enabled = True
Me.bytesDownloa dedTextBox.Text = ""
Me.totalBytesTe xtBox.Text = ""
Me.progressBar. Minimum = 0
Me.progressBar. Maximum = 0
Me.progressBar. Value = 0
Dim dl As DownloadThread = New DownloadThread
dl.DownloadUrl = Me.downloadUrlT extBox.Text
AddHandler dl.CompleteCall back, AddressOf
DownloadComplet eCallback
AddHandler dl.ProgressCall back, AddressOf
DownloadProgres sCallback
'Dim t As System.Threadin g.Thread = New
System.Threadin g.Thread(New
System.Threadin g.ThreadStart(d l.Download))
Dim t As System.Threadin g.Thread = New
System.Threadin g.Thread(New
System.Threadin g.ThreadStart(A ddressOf dl.Download))
t.Start()
End If
End Sub
End Class
I have tested it and works just perfect.
Hope I could help.
vjay
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---