• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 194
  • Last Modified:

WIndows form application and network drives

During beta testing some of my testers asked if I can place the three folders my app generates on a server, so that several users could access the data, not just one user on one pc.

My first thought is this is beyond the scope of what I want this app to be, a cheap intro to my company, generate some revenue and build the next product that will have the network ability.

Currently the scope of the project is the users gets the app (windows form application) and it runs on one machine with the folders created on the local drive.

So just for laughs I started to play with this code on a new form app,

Imports System.IO
Imports Drive_Map

Public Class Form1
    Public Function ListAllDrives() As String()
        Dim arDrives() As String
        arDrives = Directory.GetLogicalDrives()
        Return arDrives
    End Function


    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.Click

        'Remove the binding set by the LINQ method 
        'otherwise, you may get an exception
        ComboBox1.DataSource = Nothing

        'Clear items already in the list
        ComboBox1.Items.Clear()

        'Loop through the available drives
        For Each d As String In Directory.GetLogicalDrives
            ComboBox1.Items.Add(d)
        Next
        'Select the first item
        ComboBox1.SelectedIndex = 0
    End Sub

    Private Sub ComboBox1_SelectedIndexChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        'select drive letter first
        Button1.Enabled = True
        Button2.Enabled = True
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        If ComboBox1.SelectedIndex = -1 Then
            MsgBox("Please select Disk Drive to create folders in. Some network drives may not be accessable, see your network admin for help")
        End If
        Dim drive As String

        drive = ComboBox1.SelectedItem
        If My.Computer.FileSystem.DirectoryExists(drive + "\QPILABS\Machines\") Then
            MkDir("drive" + "QPILAB\Machines")

        End If

    End Sub

  
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

    End Sub
End Class

Open in new window


Here I can find the "F" drive on another computer on the home network but I can't create the folders on that drive.

It does create the folder on my local c:\ without issue.

Question is there a simple way that I can create and use a folder on a network drive? The folders will house .txt files the app reads and writes to. If this is simple I would like to do it but if not I will leave it for when this is reworked as a different kind of app, web app, using data bases rather then .txt files.

Thoughts?

Thanks

M&M
0
Matanic
Asked:
Matanic
  • 2
1 Solution
 
YZlatCommented:
Make sure you have actual permissions to create a folder on the network drive manually
0
 
YZlatCommented:
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now