talahaski Posted May 14, 2004 Posted May 14, 2004 How do I get the extension of a file. I have a openfiledialog to get the file, then I want to check the extension and perform different actions based on the file extension. I looked through the help and the only thing that was even close was file.attribute, but that is not what I need. Example if ofd.filename.extension="jpg" then file.copy(ofd.filename,newname+ofd.filename.extension) Quote
Administrators PlausiblyDamp Posted May 14, 2004 Administrators Posted May 14, 2004 if System.IO.Path.GetExtension(filename) = "jpg" then file.copy(ofd.filename,newname+ofd.filename.extension) end if Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
talahaski Posted May 14, 2004 Author Posted May 14, 2004 Thanks Thanks a bunch, I did not look in the io.path namespace. System.IO.Path.GetExtension(filename) Quote
CattleRustler Posted May 14, 2004 Posted May 14, 2004 yeah, it's the same old vb story, great tools but hard to find if you don't know the names - if you knew the names you wouldn't need to find them. At least now that everything is an object in a namespace it's a little more organized. I like to sip tea and study the Object Browser... Quote mod2software Home of the VB.NET Class Builder Utility - Demo and Full versions available now!
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.