需要有关FolderBrowserDialog或CommonOpenFileDialog的网络位置帮助 [英] need help with FolderBrowserDialog or CommonOpenFileDialog for network location

查看:111
本文介绍了需要有关FolderBrowserDialog或CommonOpenFileDialog的网络位置帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好,所以我试图用FolderBrowserDialog或CommonOpenFileDialog打开网络位置(目录),但是没有成功……显然.

OK, so I am trying to open a network location (directory) with either the FolderBrowserDialog or the CommonOpenFileDialog without success...obviously.

CommonOpenFileDialog

CommonOpenFileDialog

我将InitialDirectory设置为网络路径,然后调用ShowDialog()方法.这种行为"指的是不正当的行为.就像将要打开目录,但随后将其还原为默认目录一样.如果我在文件夹中的网络补丁中复制,将会有什么有趣的事情 文本框,然后按Enter键,提示我输入凭据.但是,当我只是去运行"时,并复制到网络路径中,然后按Enter键进入目录,而不会提示我输入凭据.就像CommonOpenFileDialog没有通过我的窗户一样 尝试打开初始目录时的凭据.有什么想法吗?

I am setting the InitialDirectory to the network path and then calling the ShowDialog() method. This "acts" like it is going to open the directory but then reverts to the default. What is interesting if I copy in the network patch in the folder text box and hit enter it prompts me for credentials. However, when I just go to "run" and copy in the network path and hit enter the directory comes up without prompting me for credentials. It's like the CommonOpenFileDialog is not passing my windows credentials when it tries to open the initialdirectory. Any ideas on this?

FolderBrowserDialog

FolderBrowserDialog

我正在设置selectedfolder属性,然后调用showdialog()方法.这是行不通的,您无法输入任何内容将其发送到网络文件夹.该服务器不在LAN网络上,因此我也无法以这种方式浏览到该服务器.

I am setting the selectedfolder attribute then calling the showdialog() method. This is not working and you can't type anything in to get it out to the network folders. The server is not on the LAN network so I can't browse to it that way either.

感谢您的帮助!
领口

Any help is appreciated!
neech

neech

推荐答案

 不确定是否有任何帮助, 您可以对其进行测试,以查看是否可以导航到该目录.您可能还想浏览以下Google搜索结果中的某些链接,以查看是否有任何帮助 信息.尽管您可能已经搜索了大多数.

 Not sure if any of this will help or not but,  you can test it just to see if you can navigate to the directory.  You may also want to look through some of the links in the google search result below just to see if you can find any helpful info.  Although you may have searched most of them already.

  搜索结果

 Search Results

Imports System.Reflection

Public Class Form1
    Private SelectedFolder As String = ""

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Using fb As New FolderBrowserDialog
            Dim RootFolderFeildInfo As FieldInfo = fb.GetType.GetField("rootFolder", BindingFlags.NonPublic Or BindingFlags.Instance)
            RootFolderFeildInfo.SetValue(fb, DirectCast(18, Environment.SpecialFolder))

            'If you can navigate to the directory you want, then replace this example path with that one
            'fb.SelectedPath = "\\USERNAME-PC\SomeDirectoryName\TheDirectoryName"

            If fb.ShowDialog() = DialogResult.OK Then
                SelectedFolder = fb.SelectedPath
                MessageBox.Show(SelectedFolder) 'will show you the path you selected. You can copy the path from the messagebox using (Ctrl+C)
            End If
        End Using
    End Sub
End Class


这篇关于需要有关FolderBrowserDialog或CommonOpenFileDialog的网络位置帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆