检查列表框中单击的文件类型 [英] Check the type of file clicked in a listbox

查看:63
本文介绍了检查列表框中单击的文件类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在列表框中检查对象的文件类型?

How can I check the file type of an object in my listbox?

我要从在线服务器返回一个字符串列表,只是想单击一个末尾具有.folder文件类型的项目时触发该事件.

I'm returning a list of strings from an online server and simply wanting to have an event that gets fired when I click on an item that has a .folder file type at the end.

我尝试查找,但找不到任何东西.

I've tried looking but can't find anything.

有人可以提供链接或示例代码,以便我实现我想要实现的目标.

Can someone please provide a link or sample code so I can achieve what I would like to achieve.

推荐答案

您可以包括FileInfo程序集并使用FileInfo.Extension.

You could include the FileInfo assembly and use FileInfo.Extension.

FileInfo finfo = new FileInfo(fileName);
string fileName = finfo.Extension

这篇关于检查列表框中单击的文件类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆