Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Sub mapDrive(ByVal strDriveLetter As String, _
ByVal strShare As String, _
Optional ByVal bPersistent As Boolean = True)
Dim myNetwork As IWshRuntimeLibrary.IWshNetwork
myNetwork = New IWshRuntimeLibrary.IWshNetwork_Class()
'see below for error checking
Try
myNetwork.MapNetworkDrive(strDriveLetter, strShare)
Catch exc As Exception
MessageBox.Show(Me, exc.Message.ToString)
End Try
End Sub
Private Sub MapDrive(ByVal strDriveLetter As String, _
ByVal strShare As String, _
Optional ByVal bPersistent As Boolean = True)
If strDriveLetter.Length = 1 AndAlso _
IO.Directory.Exists(strShare) Then
Dim strShellCommand, strPersistent As String
If bPersistent Then
strPersistent = "Yes"
Else
strPersistent = "No"
End If
strShellCommand = "NET USE " & strDriveLetter & _
": " & strShare & _
" /PERSISTENT:" & strPersistent
'shell out the command and
'wait for up to 1 minute
Shell(strShellCommand, AppWinStyle.Hide, True, 60000)
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Button1.Click
MapDrive("G", "\\ComputerName\ShareName", False)
End Sub