0

I am currently working on a program in VB where I have a text box that I drag files into and the path of that file then displays in the text box. The issue is that these files are stored on multiple different servers and instead of displaying the server path it displays the drive letter that is associated on that server on that specific computer. So it displays as driveLetter:\folder\file when it should display as \server\serverName\folder\file. Here is the code. Any suggestions?

Private Sub Form1_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles Me.DragEnter
    If (e.Data.GetDataPresent(DataFormats.FileDrop)) Then
        e.Effect = DragDropEffects.Copy
    Else
        e.Effect = DragDropEffects.None
    End If
End Sub

Private Sub Form1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles Me.DragDrop
    Dim link() As String = e.Data.GetData(DataFormats.FileDrop)
    For Each path In link
        LclTxt.Text = path
    Next
End Sub

Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    Me.AllowDrop = True
End Sub
Mark
  • 8,140
  • 1
  • 14
  • 29
  • If the user has the drive letter mapped to the server, it *should* work... are you having any problem when running the code? Or you just want the path to always include the servername? – Josh Part Jul 23 '15 at 18:29
  • Possible duplicate of http://stackoverflow.com/questions/16185716/vb-net-code-to-convert-shared-local-path-to-unc-path – Eric Walker Jul 23 '15 at 19:18

0 Answers0