Read Extension of file in resources

故事扮演 提交于 2019-12-30 07:27:09

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!