简体   繁体   中英

Vb.net (VS 2010) and connecting to network drive?

I have the simplest problem, but after a day i still cant figure it out. SO be warned the solution may be a tad embarrassing on my part.

All i am trying to do is read and write files to a shared folder on a network in visual basic (VS 2010). I can go to the folder through windows without a problem and without being prompted for a password. However when i try to do it through visual basic, it cant find the directory. Here is my small snippet of code that i (hope) is telling me that the program cannot connect to the folder.

  If Not My.Computer.FileSystem.DirectoryExists("Z:\_Cannon") Then
        StatusStrip.Text = "Cannot Connect to Network"
        Con = False
        MsgBox("Cannot Connect to Network. Test results will not be saved")
    Else : Con = True
    End If

I really am astounded this is taking me so long to figure out. Are there any known issues with VS 2010 that may cause this? Maybe something else in my code that could have an effect? This is in my form_load event though, so it is literally one of the first things that runs.

Any help would be greatly appreciated. Thanks!

我有一个类似的问题,从我可以回想起驱动器映射只适用于当前用户而c#'将不起作用,最好的解决方案是给它完整的路径\\\\computername\\_Cannon

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM