Start by using the debugger to find out what exactly you have in
ext
when you run your code. Put a breakpoint on the line:
Dim tab() As String = ext.Split(".")
And when the debugger hits it, look at the content of ext. Check with Windows Explorer that the folder, file, and drive are all accessible, and that it is a valid path name.
If so, step the debugger, and look at exactly what you get in in
tab
after the Split is done. Pay attention to
tab(1)
- does it exactly match your strings, bearing in mind that strings
are case sensitive, so "JPG" it not the same as "jpg" and so forth.
Sorry, but we can't do any of that for you - time for you to learn a new (and very, very useful) skill: debugging!