By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,579 Members | 1,770 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,579 IT Pros & Developers. It's quick & easy.

Checking for valid image in VB.Net

P: n/a
Dear All,
I am working on an imaging application in Visual Basic.Net and I want
the application to check and see if the image is valid that I am loading so
that my application will not crash when loading the image. For example, if
someone creates a file that is not an JPEG yet it has that extension, how
can I program the application so that it will detect this? Thank you very
much in advance for your time and attention in this matter.
Sincerely,
Christopher Koeber
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Dim b As Bitmap
Try
b = Bitmap("c:\image.jpg")
Catch ex As Exception
MessageBox.Show("Error")
End Try

Igor Stanek

"Christopher Kurtis Koeber" <c_******@myrealbox.com> wrote in message
news:uh**************@TK2MSFTNGP15.phx.gbl...
Dear All,
I am working on an imaging application in Visual Basic.Net and I want
the application to check and see if the image is valid that I am loading
so that my application will not crash when loading the image. For example,
if someone creates a file that is not an JPEG yet it has that extension,
how can I program the application so that it will detect this? Thank you
very much in advance for your time and attention in this matter.
Sincerely,
Christopher Koeber

Nov 21 '05 #2

P: n/a
Dim b As Bitmap
Try
b = New Bitmap("c:\image.jpg")
Catch ex As Exception
MessageBox.Show("Error")
End Try

"Igor Stanek" <i.***********@chastia.com> wrote in message news:ep**************@TK2MSFTNGP14.phx.gbl...
Dim b As Bitmap
Try
b = Bitmap("c:\image.jpg")
Catch ex As Exception
MessageBox.Show("Error")
End Try



Igor Stanek

"Christopher Kurtis Koeber" <c_******@myrealbox.com> wrote in message
news:uh**************@TK2MSFTNGP15.phx.gbl...
Dear All,
I am working on an imaging application in Visual Basic.Net and I want
the application to check and see if the image is valid that I am loading
so that my application will not crash when loading the image. For example,
if someone creates a file that is not an JPEG yet it has that extension,
how can I program the application so that it will detect this? Thank you
very much in advance for your time and attention in this matter.
Sincerely,
Christopher Koeber


Nov 21 '05 #3

P: n/a
Thanks, a lot, works like a charm!

Christopher
"Igor Stanek" <i.***********@chastia.com> wrote in message
news:ep**************@TK2MSFTNGP14.phx.gbl...
Dim b As Bitmap
Try
b = Bitmap("c:\image.jpg")
Catch ex As Exception
MessageBox.Show("Error")
End Try

Igor Stanek

"Christopher Kurtis Koeber" <c_******@myrealbox.com> wrote in message
news:uh**************@TK2MSFTNGP15.phx.gbl...
Dear All,
I am working on an imaging application in Visual Basic.Net and I want
the application to check and see if the image is valid that I am loading
so that my application will not crash when loading the image. For
example, if someone creates a file that is not an JPEG yet it has that
extension, how can I program the application so that it will detect this?
Thank you very much in advance for your time and attention in this
matter.
Sincerely,
Christopher Koeber


Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.