.Net determine if file actually exists

I have a sub routing that pulls data out of SQL Server table

One of the rows returned is a file path to an image in the web sites sub folder .../customerimages/

How do I determine if the file actually exists
If it does set the ,net image path

If it does not
Show a default image?
Larry Bristersr. DeveloperAsked:
Who is Participating?
Pawan KumarDatabase ExpertCommented:

You need to use File.Exists Method.

Dim FilePath As String = "yourFilePath.extension"
Console.WriteLine(If(File.Exists(FilePath), "File exists.", "File does not exist."))

Open in new window

You can read more from Microsoft on this.
Larry Bristersr. DeveloperAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.