|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Download tif from the web via a stream with progress indicationHi all,
In VB6, I could use the API too query the size of a file on the web, then download that file showing a custom progress indicator. I realize that I can use the DownloadFile method and show a UI, but I would like to indicate progress in my own form instead. In VB2005, how can I first get the filesize of the web image (a tif file), then stream that image (as an array of bytes??) to a local file while showing progress? If all else fails, I suppose I could go the API route, but I was wondering if there was a .Net native way to do it. Thanks, Lance
Show quote
Hide quote
On Thu, 7 Sep 2006 08:41:05 -0500, "Lance" <chuckyboy81070-at-onehotpotatoimeanhotmail.com> wrote: Have as look at the WebClient. I use this to simply download and then display the resulting image.>Hi all, > >In VB6, I could use the API too query the size of a file on the web, then >download that file showing a custom progress indicator. I realize that I >can use the DownloadFile method and show a UI, but I would like to indicate >progress in my own form instead. In VB2005, how can I first get the >filesize of the web image (a tif file), then stream that image (as an array >of bytes??) to a local file while showing progress? > >If all else fails, I suppose I could go the API route, but I was wondering >if there was a .Net native way to do it. > >Thanks, >Lance 'Start the download: WebClient1.DownloadDataAsync(some uri) 'In the WebClient1_DownloadProgressChanged is the "progress value": MyProgress = e.ProgressPercentage 'In the WebClient1_DownloadDataCompleted event: Dim myDatabuffer As Byte() = e.Result Dim ms As New System.IO.MemoryStream ms.Write(myDatabuffer, 0, myDatabuffer.Length) bm = New Bitmap(ms, True) Dim iWidth As Integer = bm.Width Dim iHeight As Integer = bm.Height PictureBox1.Image = bm Gene Thanks Gene. I'll look into that.
Lance Show quoteHide quote "gene kelley" <o***@by.me> wrote in message news:gps0g2th29uqr19ktsc4f1lsn2o70p7dbt@4ax.com... > On Thu, 7 Sep 2006 08:41:05 -0500, "Lance" > <chuckyboy81070-at-onehotpotatoimeanhotmail.com> wrote: > >>Hi all, >> >>In VB6, I could use the API too query the size of a file on the web, then >>download that file showing a custom progress indicator. I realize that I >>can use the DownloadFile method and show a UI, but I would like to >>indicate >>progress in my own form instead. In VB2005, how can I first get the >>filesize of the web image (a tif file), then stream that image (as an >>array >>of bytes??) to a local file while showing progress? >> >>If all else fails, I suppose I could go the API route, but I was wondering >>if there was a .Net native way to do it. >> >>Thanks, >>Lance > > Have as look at the WebClient. I use this to simply download and then > display the resulting image. > > 'Start the download: > WebClient1.DownloadDataAsync(some uri) > > 'In the WebClient1_DownloadProgressChanged is the "progress value": > MyProgress = e.ProgressPercentage > > 'In the WebClient1_DownloadDataCompleted event: > Dim myDatabuffer As Byte() = e.Result > Dim ms As New System.IO.MemoryStream > ms.Write(myDatabuffer, 0, myDatabuffer.Length) > bm = New Bitmap(ms, True) > Dim iWidth As Integer = bm.Width > Dim iHeight As Integer = bm.Height > > PictureBox1.Image = bm > > > Gene
Async socket connection ends up in Unable to read data from....
.NET Remoting & RTD Print out contents of a hashtable Fill in textboxes programatically in ASPX Opening a space delimited textfile in Excel using VB.net entlib UpdateDataSet how to update the database? how to receive data from .NET socket into VB6 winsock ? embedded text file PopMenu vs ContextMenu "Longest common substring" problem implementation |
|||||||||||||||||||||||