size of image file

I want to be able to add image files (jpg) to listbox1 if the size is more than 25kb. I can't use fileinfo?

Dim myfileinfo As FileInfo

Dim mydir As DirectoryInfo = New DirectoryInfo("c:\sample")

For Each myfileinfo In mydir.GetFiles

    if the size of the file >25 kb then add it to listbox1  ++++++++++++++++++++++

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Try this

If myFileInfo.Length > 25,000 Then 'lazy, you can work out what 25k is ;-)
End if

Less lazy

If myFileInfo.Length > (25 * 1024) Then
End if

VBdotnet2005Author Commented:
I'm not familiar with (25 * 1024). What is it?
Fernando SotoRetiredCommented:
You want to test for a file size greater then 25K. To do this you multiply 25 and the value of 1K which is actually 1024 and the results is 25K or more precisely 25600 bytes. ==> (25 * 1,024) = 25,600

Taking Roger example you could do it this way

If myFileInfo.Length > 25600 Then
End if

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.