问题
How can I write a code to read the extension of a My.Resources
file?
Example:
if i have a file named IMG.JPEG
in my resources
How can I make msgbox to show the extension .JPEG
?
I can show the file name but without extension with this
For Each Fe In My.Resources.ResourceManager.GetResourceSet _
(System.Globalization.CultureInfo.CurrentCulture, False, True)
MsgBox(Fe.Key)
Next
any help would be greatly appreciated
EDIT:
I can get the extension of file but as .BYTE[]
and pictures as .Bitmap
with this code
GT = Path.GetExtension(My.Resources.ResourceManager.GetObject(Fe.Key).ToString)
MsgBox(GT)
How can i get the original extension?
回答1:
If you have the filename you just need:
sExt = System.IO.Path.GetExtension(sFileName)
Or:
sExt = sFileName.SubString(sFileName.LastIndexOf("."c))
来源:https://stackoverflow.com/questions/14763867/read-extension-of-file-in-resources