WebBrowser control get IMG file size

WebBrowser control get IMG file size in DocumentCompleted event

Page 1 of 1

2 Replies - 4574 Views - Last Post: 10 September 2009 - 07:15 AM Rate Topic: -----

#1 tjmcdevitt  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 31-August 09

WebBrowser control get IMG file size

Posted 09 September 2009 - 06:05 PM

I have a ASP Win Application that has the webBrowser control in the DocumentCompleted event I have a loop that will get all the IMG tag of a web site. With the url to the image file I like to get the size of the file.
Let me know if anybody have any ideas.
thanks
TJ

Private Sub WebBrowser1_DocumentCompleted(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
		Dim imagearray As New ArrayList
		Dim element As System.Windows.Forms.HtmlElement
		For Each element In Me.WebBrowser1.document.GetElementsByTagName("img")
		imagearray.Add(element.OuterHtml)

		Next
		MsgBox(imagearray.Count)

	End Sub



Code tags added - PsychoCoder :)

Is This A Good Question/Topic? 0
  • +

Replies To: WebBrowser control get IMG file size

#2 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: WebBrowser control get IMG file size

Posted 10 September 2009 - 07:07 AM

The WebBrowser control is a Windows Forms control, not ASP.NET.

Moving to VB.NET.
Was This Post Helpful? 0
  • +
  • -

#3 W3bDev  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 42
  • View blog
  • Posts: 379
  • Joined: 15-March 09

Re: WebBrowser control get IMG file size

Posted 10 September 2009 - 07:15 AM

You can try using the system.io.fileinfo method:

System.IO.FileInfo fileSize = new System.IO.FileInfo(PathToImage)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1