---
title: "Check the type of file clicked in a listbox"  
description: "Check the type of file clicked in a listbox"  
author: "Mark Devid"  
published: 2013-09-04  
updated: 2013-09-04  
canonical: https://www.mindstick.com/forum/1452/check-the-type-of-file-clicked-in-a-listbox  
category: "c#"  
tags: ["c#", "mindstick", "listbox", "check file type", "free open source"]  
reading_time: 1 minute  

---

# Check the type of file clicked in a listbox

How can I [check](https://yourviews.mindstick.com/story/2248/never-forget-to-check-these-specifications-before-buying-a-mobile-phone) the file type of an object in my [listbox](https://www.mindstick.com/articles/626/listbox-events-in-c-dot-net)

I'm [returning](https://www.mindstick.com/news/2477/returning-ceo-bob-iger-dismisses-the-disney-apple-sale-as-pure-speculation) a list of [strings](https://www.mindstick.com/forum/161912/explain-the-python-strings) from an [online](https://www.mindstick.com/articles/13083/benefits-of-students-who-can-get-online-assignment) [server](https://www.mindstick.com/articles/43769/what-is-serverless-architecture-is-it-worth-switching-over) and simply wanting to have an [event](https://www.mindstick.com/articles/167719/marquee-hire-benefits-of-event-lighting-hire-london) that gets fired when I [click](https://www.mindstick.com/articles/12423/social-login-magento-2-one-click-to-register-social) 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](https://www.mindstick.com/articles/23633/link-builder) or sample [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) so I can achieve what I would like to achieve.

## Replies

### Reply by Sumit Kesarwani

Hi Mark,\

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

FileInfo finfo = new Fileinfo(fileName);

string fileName = finfo.Extension


---

Original Source: https://www.mindstick.com/forum/1452/check-the-type-of-file-clicked-in-a-listbox

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
