How to get the file extension from the filepath

The following function returns the file extension only. eg. using the following function GetFileExtension(“c:\test\file.aspx”) will return “.aspx” Here is the complete function, copy and paste it in your form or a module Function GetFileExtension(ByVal sFilePath As String) As String ‘ Dim fullPath As String = “c:\MyDirectory\MYFile.txt” Dim sExtension As String = IO.Path.GetExtension(sFilePath) Return (sExtension) End […]