7 Replies - 3301 Views - Last Post: 06 May 2009 - 05:06 PM Rate Topic: -----

#1 aBz1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 12-February 09

how to check if an image exists in vb6

Posted 23 April 2009 - 04:42 AM

hi..
i would just like to ask if there is an equivalent code in vb6 to this code in vb.net..
i've put here a bit of my codes..

if file.io.exists(filename) then
   'executable statement
end if



is there a similar way where i can check if an image exists in the computer?

i do not know how to save files in a database yet so i am using this..it fits my program's needs..


thanks in advance!

Is This A Good Question/Topic? 0
  • +

Replies To: how to check if an image exists in vb6

#2 aBz1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 12-February 09

Re: how to check if an image exists in vb6

Posted 23 April 2009 - 04:43 AM

hi..
i would just like to ask if there is an equivalent code in vb6 to this code in vb.net..
i've put here a bit of my codes..

if file.io.exists(filename) then
   'executable statement
end if



is there a similar way where i can check if an image exists in the computer?

i do not know how to save files in a database yet so i am using this..it fits my program's needs..


thanks in advance!
Was This Post Helpful? 0
  • +
  • -

#3 firebolt  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 92
  • View blog
  • Posts: 5,561
  • Joined: 20-February 09

Re: how to check if an image exists in vb6

Posted 23 April 2009 - 05:14 AM

Something like:
Function FileExists(FileName As String) As Boolean
        FileExists = (GetAttr(FileName) And vbDirectory) = 0
End Function


Was This Post Helpful? 0
  • +
  • -

#4 firebolt  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 92
  • View blog
  • Posts: 5,561
  • Joined: 20-February 09

Re: how to check if an image exists in vb6

Posted 23 April 2009 - 05:14 AM

Please don't create duplicate posts.

Edit:
Thanks William_Wilson

This post has been edited by firebolt: 23 April 2009 - 05:58 AM

Was This Post Helpful? 0
  • +
  • -

#5 William_Wilson  Icon User is offline

  • lost in compilation
  • member icon

Reputation: 205
  • View blog
  • Posts: 4,807
  • Joined: 23-December 05

Re: how to check if an image exists in vb6

Posted 23 April 2009 - 05:58 AM

Topics merged.
Was This Post Helpful? 0
  • +
  • -

#6 aBz1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 12-February 09

Re: how to check if an image exists in vb6

Posted 05 May 2009 - 11:41 PM

is there something else i might be missing here?
because i tried it like this..

if fileexists(filename from database)=true then
	'statement
else
	'statement
end if




an error still occurs when the file is not found..("file not found", end/debug)
i also tried putting this on my else statement:

on error goto errhandler
errhandler:
statements
 


but it still pops up when the filename doesnt exist..i want it to do other statements if it doesnt fid the file..

This post has been edited by aBz1: 05 May 2009 - 11:42 PM

Was This Post Helpful? 0
  • +
  • -

#7 firebolt  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 92
  • View blog
  • Posts: 5,561
  • Joined: 20-February 09

Re: how to check if an image exists in vb6

Posted 06 May 2009 - 12:17 AM

Did you test out my example?
Was This Post Helpful? 0
  • +
  • -

#8 aBz1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 12-February 09

Re: how to check if an image exists in vb6

Posted 06 May 2009 - 05:06 PM

i used your example..but an error still occurs when the file is not found..and the error is in the function itself..(file not found error)
is there something im not doing right?


Function FileExists(FileName As String) As Boolean	  'FUNCTION FOR CHECKING IF IMAGE EXISTS
	FileExists = (GetAttr(FileName) And vbDirectory) = False
End Function


private sub a_click
  if fileexists(image filename)=true then
	 'statement
  else
	 'statement
  end if
end sub


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1