Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8641707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:35:49+00:00 2026-06-12T11:35:49+00:00

Possible Duplicate: How to detect a USB device has been plugged in? I want

  • 0

Possible Duplicate:
How to detect a USB device has been plugged in?

I want to create c# .net windows application in which i want to show message when any USB device is connected to the local machine.

Also when this USB device is been connected i want to read a particular file in it.

My problem is that how should i determine the drive name of USB for reading file.

Eg.On particular machine if there are only two drives (c and d)…the usb drive detected over there wil be e. but on another machine if there are 3 drives then in that case USB drive can be f.

What shoud i do in that case for showing the message on connection of USB drive and reading the particular file in that drive.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T11:35:50+00:00Added an answer on June 12, 2026 at 11:35 am

    For your first question check this link: How do I detect when a removable disk is inserted using C#?

    For the other part of your question:

    Also when this USB device is been connected i want to read a
    particular file in it.

    You can get the drive letter and the volume label of all the removable drives connected to your system like this :

      DriveInfo[] allDrives = DriveInfo.GetDrives();
    foreach (DriveInfo d in allDrives)
    {
    if (d.DriveType == DriveType.Removable) 
    {   
      Console.WriteLine("Drive {0}", d.Name);       
            Console.WriteLine("  Volume label: {0}", d.VolumeLabel);
    }
    }  
    

    If the volume label of the USB drive is going to be same then its not a problem else you will have to search for the required file in all the removable drives connected to your system.
    Hope it helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: How to detect true Windows version I have an application which uses
Possible Duplicate: Detect if an outgoing call has been answered How can I know
Possible Duplicate: How to detect Windows 64 bit platform with .net? I'm using this
Possible Duplicate: How to detect Windows 64 bit platform with .net? At a low
Possible Duplicate: Detect Antivirus on Windows using C# In .net I would like to
Possible Duplicate: How to detect Windows 64 bit platform with .net? How do you
Possible Duplicate: How to detect Windows 64 bit platform with .net? How can I
Possible Duplicate: Detect if device is iOS Here is what I want to do:
Possible Duplicate: How can we programmatically detect which iOS version is device running on?
Possible Duplicate: Best way to programmatically detect iPad/iPhone hardware For example I want my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.