how to check if one the resource file (ie image file) exist in the Images folder?
Thanks
Teo
how to check if one the resource file (ie image file) exist in the Images folder?
Thanks
Teo
Can you explain some more?
i want to display a product image file into a grid. Normally, the image files will be downloaded from a website into device upon app running. However, I would like to check an image is already existed in app images folder. I will display a default image(noimage.png) if the related image file not being downloaded (image file not exists) yet.
similar function in VB, FileSystem.FileExists(path)
Thanks
Teo
How are you displaying the images?
img="Image\test.png"
if not fileexists(img) then img="Image\noimage.png"
grid1.setvalue(1,1,"<img scr='" & img & "'>")
but fileexists is not a function
Thanks
Teo
You could try
if img = "null" or img = "undefined" then
img="Image\noimage.png"
Some more info: How do I check if file exists in jQuery or pure JavaScript? - Stack Overflow
img=“null” or “undefined” is not working since img is a string
my solution
img="Images\test.png"
grid1.setvalue(i,0,"<img src='" & img & "' height=80 width=80 name='imginv_" & i & "_1' id='imginv_" & i & "_1' onerror='imgError(this)'>")
function imgError(obj)
If IsNull(obj) Then Exit Function
s=Split(obj.name,"_")
img="Images\noimage.png"
grid1.setvalue(s(1),0,"<img src='" & img & "' height=80 width=80 name='imginv_" & s(1) & "_1' id='imginv_" & s(1) & "_1'>")
end function