Get the file extension of the file chosen by OpenFileDialog

Viewed 7004

I am using an OpenFileDialog to allow the user to select a file. How do I then get the extension of the file that they chose? I need to perform a different action depending on the type of file. For instance, if they choose a PDF file, I need to launch a PDF viewer, but if it's am image, I need to show it in a PictureBox.

2 Answers
Related