阅读资源中的文件扩展名 [英] 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屋!
查看全文