TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
C # Identify a removable hard drive
Carmelo La Monica
Apr 26
2015
Code
1.1
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
C # Identify a remov
using
System;
using
System.IO;
using
System.Windows.Forms;
namespace
WindowsFormsApplication1
{
public
partial
class
Form1 : Form
{
public
Form1()
{
InitializeComponent();
}
private
void
BtnFind_Click(
object
sender, EventArgs e)
{
foreach
(DriveInfo drive
in
DriveInfo.GetDrives())
{
if
(drive.DriveType.Equals(DriveType.Removable))
{
MessageBox.Show(drive.Name.ToString() +
"is an external derive."
);
}
else
{
MessageBox.Show(
"Not external drive avialible"
);
return
;
}
}
}
}
}
C#