读取资源中文件的扩展名 [英] Read Extension of file in resources
本文介绍了读取资源中文件的扩展名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何编写代码来读取My.Resources
文件的扩展名?
How can I write a code to read the extension of a My.Resources
file?
示例:
如果我的资源中有一个名为 IMG.JPEG
的文件
if i have a file named IMG.JPEG
in my resources
如何让msgbox显示扩展名.JPEG
?
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
任何帮助将不胜感激
我可以得到文件的扩展名,但是作为 .BYTE[]
和图片作为 .Bitmap
和这个代码
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)
如何获取原始扩展名?
推荐答案
如果你有你只需要的文件名:
If you have the filename you just need:
sExt = System.IO.Path.GetExtension(sFileName)
或者:
sExt = sFileName.SubString(sFileName.LastIndexOf("."c))
这篇关于读取资源中文件的扩展名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文