D
Dave Marden
I am making a program for work that Maps to different hmi's (human - machine
interface) computers and makes a backup of the files we currently use in
them. It then unmaps the drives. I have a function that gets the first
available drive starting with Z and working backwords from thier. This
function works well in vb2005 but our work pc's only have .net framework
1.1.4322 so I need to change it to work with vb2003. Please help me with my
problem.
The following is the code I am currently using for this.
Public Function GetDriveLetter()
Dim intAlpha As Integer
Dim strAlpha As String
Dim boolDriveExists As Boolean
Dim myDrives As DriveInfo() = DriveInfo.GetDrives()
strAlpha = "ZYXWVUTSRQPONMLKJIHGFEBDA"
For intAlpha = 1 To Len(strAlpha)
boolDriveExists = False
GetDriveLetter = Mid(strAlpha, intAlpha, 1) & ":"
For Each d As DriveInfo In myDrives
If d.Name = CStr(GetDriveLetter & "\") Then
boolDriveExists = True
End If
Next
If boolDriveExists = False Then
Exit Function
End If
Next
End Function
Any help would be appreciated,
Dave Marden
interface) computers and makes a backup of the files we currently use in
them. It then unmaps the drives. I have a function that gets the first
available drive starting with Z and working backwords from thier. This
function works well in vb2005 but our work pc's only have .net framework
1.1.4322 so I need to change it to work with vb2003. Please help me with my
problem.
The following is the code I am currently using for this.
Public Function GetDriveLetter()
Dim intAlpha As Integer
Dim strAlpha As String
Dim boolDriveExists As Boolean
Dim myDrives As DriveInfo() = DriveInfo.GetDrives()
strAlpha = "ZYXWVUTSRQPONMLKJIHGFEBDA"
For intAlpha = 1 To Len(strAlpha)
boolDriveExists = False
GetDriveLetter = Mid(strAlpha, intAlpha, 1) & ":"
For Each d As DriveInfo In myDrives
If d.Name = CStr(GetDriveLetter & "\") Then
boolDriveExists = True
End If
Next
If boolDriveExists = False Then
Exit Function
End If
Next
End Function
Any help would be appreciated,
Dave Marden