There is no "OR" operator. Should be:
if ((filext == ".png") || (filext == ".jpeg"))
Can you spot the difference? :-)
Besides, this check is no good, because it misses the possibility of correct names with "*.PnG", "*.JPG", "*.JPg" and so on. You don't really need to use it, as you can use the file dialog filter. But if you think you really need to checkup "extension", it could be something like:
loExt = fileExt.ToLower();
if ((loExt == ".png") || (loExt == ".jpeg") || (loExt == ".jpg"))
Please see:
http://msdn.microsoft.com/en-us/library/system.string.tolower.aspx[
^].
And finally, even though you need to use '||' in almost all cases, you should clearly understand the difference between '|' and '||' operators:
http://msdn.microsoft.com/en-us/library/kxszd0kx.aspx[
^],
http://msdn.microsoft.com/en-us/library/6373h346.aspx[
^].
—SA