VB.NET School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

 

Code Snippets

  

VB.NET Source Code


Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 340,163 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 4,049 people online right now. Registration is fast and FREE... Join Now!




IsNetworkDrive

Determines whether a drive is a network drive or not.

Submitted By: RodgerB
Actions:
Rating:
Views: 941

Language: VB.NET

Last Modified: December 6, 2007
Instructions:
1) Copy and paste the function into a class.
2) Read below on how to call the function.

Snippet


  1. ''' <summary>
  2. ''' Determines whether a drive is a network drive or not.
  3. ''' </summary>
  4. ''' <param name="driveLetter">The letter of the drive, e.g "c".</param>
  5. ''' <returns>True if the drive is a network drive, False otherwise.</returns>
  6. ''' <remarks></remarks>
  7.  
  8. Public Shared Function IsNetworkDrive(ByRef driveLetter As String) As Boolean
  9.     Dim driveInfo As System.IO.DriveInfo, driveType As System.IO.DriveType
  10.     driveInfo = My.Computer.FileSystem.GetDriveInfo(driveLetter)
  11.     driveType = driveInfo.DriveType
  12.     If driveType = IO.DriveType.Network Then Return True
  13.     Return False
  14. End Function
  15.  
  16. ' How to call the function:
  17. Dim boolNetworkDrive As Boolean = IsNetworkDrive("c")

Copy & Paste


Comments

There are currently no comments for this snippet. Be the first to comment!

Add comment


You must be registered and logged on to </dream.in.code> to leave comments.





Live VB.NET Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month