trim a file name from openfiledialog

odelya

Member
Joined
Mar 13, 2005
Messages
10
Programming Experience
Beginner
hi!
i have an openfiledialog.
i want only the name+postfix of the file.
in asp.net i have this code:

sFileName = Right(Submit1.PostedFile.FileName.Trim, _Len(Submit1.PostedFile.FileName.Trim) - i)

(i can write openfiledialog.filename.trim instead of submit1.postfile.filename)
but in vb.net he doesn't recognaize the function "right".

any solution?

thanx
 

Paszt

Staff member
Joined
Jun 3, 2004
Messages
1,500
Location
Raleigh, NC - USA
Programming Experience
Beginner
If by postFix you mean the extension: look at the System.IO.Path.GetFileName function. This function returns the file name and extension of the specified path string.

Also note that the Right function is a member of the Microsoft.VisualBasic.Strings class, but it's really only included for backwards compatablility. You should look at the new VB.NET System.String.Substring function.
 
Top Bottom