Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

VS 2010 [RESOLVED] Checking for a drive letter

$
0
0
I want to check for a certain drive letter. I use this to get all the drives on my PC:

Code:

Dim allDrives() As DriveInfo = DriveInfo.GetDrives()
Now I want to check if a certain drive exists. I'm not sure how to use the .Contains method here ... can anyone help?

This code doesn't work:

Code:

If allDrives.Contains("D:") Then
    'do something
End If

Should I be able to use .Contains or do I have to loop through the collection of drives? Thanks...

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>