File extension

talahaski

Active member
Joined
Apr 29, 2004
Messages
35
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)
 
Thanks

Thanks a bunch, I did not look in the io.path namespace.

System.IO.Path.GetExtension(filename)
 
yeah, its the same old vb story, great tools but hard to find if you dont know the names - if you knew the names you wouldnt need to find them.

At least now that everything is an object in a namespace its a little more organized.

I like to sip tea and study the Object Browser...
 
Back
Top