If your downloading a file from a specified URL then this can get the filename from url.
VB.NET Code:
  1. Public Function GetFileNameFromURL(ByVal URL As String) As String
  2.         Try
  3.             Return URL.Substring(URL.LastIndexOf("/") + 1)
  4.         Catch ex As Exception
  5.             Return URL
  6.         End Try
  7.     End Function