FolderBrowserDialog于2005年挂起 [英] FolderBrowserDialog hangs in 2005

查看:60
本文介绍了FolderBrowserDialog于2005年挂起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个使用FolderBrowserDialog的应用程序。


构建应用程序,安装并运行它,并使用表格

使用对话框,它挂起文件夹选择并进入无响应


调试时,它会在执行提取

选中的行时挂起文件夹没有进一步解释在执行标有<<<<<<<<<<<<<<<<<<<<<<<下面。当我跨过

行时,它会挂起。


使用FolderBrowserDialog1

..RootFolder = Environment.SpecialFolder.Desktop


..SelectedPath = Environment.SpecialFolder.Desktop

..Description ="请选择所需的模板... ;


如果.ShowDialog = DialogResult.Cancel那么


退出子


结束如果


如果.ShowDialog = DialogResult.OK那么


DestinationPath = .SelectedPath<<<<<<<<< ;


结束如果


结束

我注意到在VS2005中使用下载的exe创建了相同的行为

文件夹浏览器---因此,我有两个indenpent实例的

browserdialog挂起,一个不是我的创作。


任何见解?


-

脾气暴躁的航空人


解决方案

你打电话的原因。 ShowDialog两次?


i建议这样的事情;


Dim dlResult As DialogResult


dlResult = .ShowDialog


如果dlResult = Windows.Forms.DialogResult.Cancel那么

退出Sub

ElseIf dlResult = Windows.Forms。 DialogResult.Ok然后

DestinationPath = .SelectedPath

结束如果

Meelis



Grumpy Aero Guy < fb@beerme.org>在消息中写道

新闻:k5 ***************** @ tornado.ohiordc.rr.com ...

我创建了一个使用FolderBrowserDialog的应用程序。

在构建应用程序,安装和运行它,并使用对话框调用表单时,它会挂起文件夹选择并转到 ;没有响应

在调试时,它会在执行提取
所选文件夹的行时挂起,无需进一步说明。在执行标有<<<<<<<<<<<<<<<<<下面。当我跨过
那行时,它会挂起。

使用FolderBrowserDialog1
.RootFolder = Environment.SpecialFolder.Desktop

.SelectedPath = Environment.SpecialFolder .Desktop

。描述="请选择所需的模板......

如果.ShowDialog = DialogResult.Cancel那么

结束如果

如果.ShowDialog = DialogResult.OK然后

DestinationPath = .SelectedPath<<<< <<<

结束如果

结束

我注意到在VS2005中使用<创建的下载exe中的相同行为文件夹浏览器---因此,我有两个悬挂的浏览器对话实例,一个不是我的创作。

任何见解?

- -
Grumpy Aero Guy



足够公平....


但是,我仍然挂在DestinationPath = .SelectedPath行。


-

G rumpy Aero Guy


" Meelis" < me*@hot.ee>写在消息

新闻:uY ************** @ TK2MSFTNGP04.phx.gbl ...

为什么你打电话.ShowDialog两次?

我建议这样的事情;

Dim dlResult As DialogResult

dlResult = .ShowDialog

如果dlResult = Windows.Forms.DialogResult.Cancel然后
退出Sub
ElseIf dlResult = Windows.Forms.DialogResult.Ok然后
DestinationPath = .SelectedPath
结束如果

Meelis


Grumpy Aero Guy < fb@beerme.org>在消息中写道
新闻:k5 ***************** @ tornado.ohiordc.rr.com ...

我创建了一个使用FolderBrowserDialog的应用程序。

在构建应用程序,安装和运行它,并使用对话框调用表单时,它会挂起文件夹选择并且不是
响应

在调试时,它会在执行提取
所选文件夹的行时挂起,无需进一步说明。在执行标有<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<下面。当我跨过


行时,它会挂起。

使用FolderBrowserDialog1
.RootFolder = Environment.SpecialFolder.Desktop

.SelectedPath = Environment.SpecialFolder.Desktop

。描述="请选择所需的模板......

如果。 ShowDialog = DialogResult.Cancel然后

退出Sub

结束如果

如果.ShowDialog = DialogResult.OK那么

DestinationPath = .SelectedPath<<<<<<<<<

结束如果

结束

我注意到了使用
文件夹浏览器在VS2005中创建的下载exe中的相同行为---因此,我有两个ondenpent实例的
browserdialog挂起,其中一个不是我的创作。

任何见解?

-
Grumpy Aero Guy




这是一个不使用该组件的文件夹浏览器..... />

--------------------------------

导入System.Windows.Forms.Design


公共类BrowseForFolder

继承FolderNameEditor


Public Enum enuFolderBrowserFolder

桌面= FolderBrowserFolder.Desktop

收藏夹= FolderBrowserFolder.Favorites

MyComputer = FolderBrowserFolder.MyComputer

MyDocuments = FolderBrowserFolder.MyDocuments

MyPictures = FolderBrowserFolder.MyPictures

NetAndDialUpConnections =

FolderBrowserFolder.NetAndDialUpConnections

NetworkNeighborhood = FolderBrowserFolder.NetworkNeighborhood
打印机= FolderBrowserFolder.Printers

最近= FolderBrowserFolder.Recent

SendTo = FolderBrowserFolder.SendTo

StartMenu = FolderBrowserFolder.StartMenu

Templates = FolderBrowserFolder.Templates

结束枚举


''FolderBrowserStyles集合是一个FolderNameEditor的成员

Public Enum enuFolderBrowserStyles

BrowseForComputer = FolderBrowserStyles.BrowseForComputer

BrowseForEverything = FolderBrowserStyles.BrowseForEverything

BrowseForPrinter = FolderBrowserStyles.BrowseForPrinter

RestrictToDomain = FolderBrowserStyles.RestrictToDomain

RestrictToFilesystem = FolderBrowserStyles.RestrictToFilesystem

RestrictToSubfolders = FolderBrowserStyles.RestrictToSubfolders

ShowTextBox = FolderBrowserStyles.ShowTextBox

结束枚举


公共StartLocation为enuFolderBrowserFolder =

enuFolderBrowserFolder.MyDocuments''.BrowseForComputer
公共样式为enuFolderBrowserStyles =

enuFolderBrowserStyles.ShowTextBox


私有mstrDescription As String ="请选择下面的目录:"

私有mstrPath As String = String.Empty

私人mobjFB为Ne w FolderBrowser()


''在对话框中添加说明

公共属性说明()为字符串

获取

返回mstrDescription

结束获取

设置(ByVal值为字符串)

mstrDescription = Value

结束集

结束物业


Public ReadOnly Property Path()As String

获取

返回mstrPath

结束获取

结束属性


公共函数ShowBrowser()As System.Windows.Forms.DialogResult

使用mobjFB

。描述= mstrDescription

.StartLocation = CType(Me.StartLocation,

FolderNameEditor.FolderBrowserFolder)

.Style = CType(Me.Style,FolderNameEditor.FolderBrowserStyles)

Dim dlgResult As DialogResult = .ShowDialog

如果dlgResult = DialogResult.OK然后

mstrPath = .DirectoryPath

否则

mstrPath = String.Empty

结束如果

Ret urn dlgResult

结束

结束功能


结束班级

------ --------------------------


用法就像....


--------------------------------

Dim objFB As新的BrowseForFolder()

如果objFB.ShowBrowser = Windows.Forms.DialogResult.OK然后

MessageBox.Show(objFB.Path)

结束如果

--------------------------------


Grumpy Aero Guy < fb@beerme.org>在消息中写道

新闻:k5 ***************** @ tornado.ohiordc.rr.com ...

我创建了一个使用FolderBrowserDialog的应用程序。

在构建应用程序,安装和运行它,并使用对话框调用表单时,它会挂起文件夹选择并转到 ;没有响应

在调试时,它会在执行提取
所选文件夹的行时挂起,无需进一步说明。在执行标有<<<<<<<<<<<<<<<<下面。当我走过那条线时,它会挂起。

使用FolderBrowserDialog1
.RootFolder = Environment.SpecialFolder.Desktop

.SelectedPath = Environment.SpecialFolder .Desktop

。描述="请选择所需的模板......

如果.ShowDialog = DialogResult.Cancel那么

结束如果

如果.ShowDialog = DialogResult.OK然后

DestinationPath = .SelectedPath<<<< <<<

结束如果

结束

我注意到在VS2005中使用<创建的下载exe中的相同行为文件夹浏览器---因此,我有两个悬挂的浏览器对话实例,一个不是我的创作。

任何见解?

- -
Grumpy Aero Guy



I have created an app that makes use of the FolderBrowserDialog.

Upon building the app, installing and running it, and invoking the form
using the dialog, it hangs upon folder selection and goes "not responding"

Upon debugging, it hangs as well upon executing the line that extracts the
selected folder without further explanation. All looks well in the debugger
prior to executing the line marked with <<<<<< below. When I step over that
line, it hangs.

With FolderBrowserDialog1
..RootFolder = Environment.SpecialFolder.Desktop

..SelectedPath = Environment.SpecialFolder.Desktop

..Description = "Please select the desired template(s)..."

If .ShowDialog = DialogResult.Cancel Then

Exit Sub

End If

If .ShowDialog = DialogResult.OK Then

DestinationPath = .SelectedPath <<<<<<<<

End If

End With
I noticed the same behavior from a downloaded exe created in VS2005 using
the folderbrowser --- thus, I have two indenpent instances of the
browserdialog hanging, one not of my creation.

Any insights?

--
Grumpy Aero Guy


解决方案

why you call .ShowDialog twice?

i suggest something like this;

Dim dlResult As DialogResult

dlResult = .ShowDialog

If dlResult = Windows.Forms.DialogResult.Cancel Then
Exit Sub
ElseIf dlResult = Windows.Forms.DialogResult.Ok Then
DestinationPath = .SelectedPath
End If
Meelis


"Grumpy Aero Guy" <fb@beerme.org> wrote in message
news:k5*****************@tornado.ohiordc.rr.com...

I have created an app that makes use of the FolderBrowserDialog.

Upon building the app, installing and running it, and invoking the form
using the dialog, it hangs upon folder selection and goes "not responding"

Upon debugging, it hangs as well upon executing the line that extracts the
selected folder without further explanation. All looks well in the debugger prior to executing the line marked with <<<<<< below. When I step over that line, it hangs.

With FolderBrowserDialog1
.RootFolder = Environment.SpecialFolder.Desktop

.SelectedPath = Environment.SpecialFolder.Desktop

.Description = "Please select the desired template(s)..."

If .ShowDialog = DialogResult.Cancel Then

Exit Sub

End If

If .ShowDialog = DialogResult.OK Then

DestinationPath = .SelectedPath <<<<<<<<

End If

End With
I noticed the same behavior from a downloaded exe created in VS2005 using
the folderbrowser --- thus, I have two indenpent instances of the
browserdialog hanging, one not of my creation.

Any insights?

--
Grumpy Aero Guy



Fair enough....

BUT, I still hang on the DestinationPath = .SelectedPath line.

--
Grumpy Aero Guy

"Meelis" <me*@hot.ee> wrote in message
news:uY**************@TK2MSFTNGP04.phx.gbl...

why you call .ShowDialog twice?

i suggest something like this;

Dim dlResult As DialogResult

dlResult = .ShowDialog

If dlResult = Windows.Forms.DialogResult.Cancel Then
Exit Sub
ElseIf dlResult = Windows.Forms.DialogResult.Ok Then
DestinationPath = .SelectedPath
End If
Meelis


"Grumpy Aero Guy" <fb@beerme.org> wrote in message
news:k5*****************@tornado.ohiordc.rr.com...

I have created an app that makes use of the FolderBrowserDialog.

Upon building the app, installing and running it, and invoking the form
using the dialog, it hangs upon folder selection and goes "not
responding"

Upon debugging, it hangs as well upon executing the line that extracts
the
selected folder without further explanation. All looks well in the


debugger

prior to executing the line marked with <<<<<< below. When I step over


that

line, it hangs.

With FolderBrowserDialog1
.RootFolder = Environment.SpecialFolder.Desktop

.SelectedPath = Environment.SpecialFolder.Desktop

.Description = "Please select the desired template(s)..."

If .ShowDialog = DialogResult.Cancel Then

Exit Sub

End If

If .ShowDialog = DialogResult.OK Then

DestinationPath = .SelectedPath <<<<<<<<

End If

End With
I noticed the same behavior from a downloaded exe created in VS2005 using
the folderbrowser --- thus, I have two indenpent instances of the
browserdialog hanging, one not of my creation.

Any insights?

--
Grumpy Aero Guy




Here is a folder browser that does not use the component.....

--------------------------------
Imports System.Windows.Forms.Design

Public Class BrowseForFolder
Inherits FolderNameEditor

Public Enum enuFolderBrowserFolder
Desktop = FolderBrowserFolder.Desktop
Favorites = FolderBrowserFolder.Favorites
MyComputer = FolderBrowserFolder.MyComputer
MyDocuments = FolderBrowserFolder.MyDocuments
MyPictures = FolderBrowserFolder.MyPictures
NetAndDialUpConnections =
FolderBrowserFolder.NetAndDialUpConnections
NetworkNeighborhood = FolderBrowserFolder.NetworkNeighborhood
Printers = FolderBrowserFolder.Printers
Recent = FolderBrowserFolder.Recent
SendTo = FolderBrowserFolder.SendTo
StartMenu = FolderBrowserFolder.StartMenu
Templates = FolderBrowserFolder.Templates
End Enum

''The FolderBrowserStyles collection is a member of FolderNameEditor
Public Enum enuFolderBrowserStyles
BrowseForComputer = FolderBrowserStyles.BrowseForComputer
BrowseForEverything = FolderBrowserStyles.BrowseForEverything
BrowseForPrinter = FolderBrowserStyles.BrowseForPrinter
RestrictToDomain = FolderBrowserStyles.RestrictToDomain
RestrictToFilesystem = FolderBrowserStyles.RestrictToFilesystem
RestrictToSubfolders = FolderBrowserStyles.RestrictToSubfolders
ShowTextBox = FolderBrowserStyles.ShowTextBox
End Enum

Public StartLocation As enuFolderBrowserFolder =
enuFolderBrowserFolder.MyDocuments ''.BrowseForComputer
Public Style As enuFolderBrowserStyles =
enuFolderBrowserStyles.ShowTextBox

Private mstrDescription As String = "Please select a directory below:"
Private mstrPath As String = String.Empty
Private mobjFB As New FolderBrowser()

''Adds Description to dialog box
Public Property Description() As String
Get
Return mstrDescription
End Get
Set(ByVal Value As String)
mstrDescription = Value
End Set
End Property

Public ReadOnly Property Path() As String
Get
Return mstrPath
End Get
End Property

Public Function ShowBrowser() As System.Windows.Forms.DialogResult
With mobjFB
.Description = mstrDescription
.StartLocation = CType(Me.StartLocation,
FolderNameEditor.FolderBrowserFolder)
.Style = CType(Me.Style, FolderNameEditor.FolderBrowserStyles)
Dim dlgResult As DialogResult = .ShowDialog
If dlgResult = DialogResult.OK Then
mstrPath = .DirectoryPath
Else
mstrPath = String.Empty
End If
Return dlgResult
End With
End Function

End Class
--------------------------------

Usage is like....

--------------------------------
Dim objFB As New BrowseForFolder()
If objFB.ShowBrowser = Windows.Forms.DialogResult.OK Then
MessageBox.Show(objFB.Path)
End If
--------------------------------

"Grumpy Aero Guy" <fb@beerme.org> wrote in message
news:k5*****************@tornado.ohiordc.rr.com...

I have created an app that makes use of the FolderBrowserDialog.

Upon building the app, installing and running it, and invoking the form
using the dialog, it hangs upon folder selection and goes "not responding"

Upon debugging, it hangs as well upon executing the line that extracts the
selected folder without further explanation. All looks well in the
debugger prior to executing the line marked with <<<<<< below. When I
step over that line, it hangs.

With FolderBrowserDialog1
.RootFolder = Environment.SpecialFolder.Desktop

.SelectedPath = Environment.SpecialFolder.Desktop

.Description = "Please select the desired template(s)..."

If .ShowDialog = DialogResult.Cancel Then

Exit Sub

End If

If .ShowDialog = DialogResult.OK Then

DestinationPath = .SelectedPath <<<<<<<<

End If

End With
I noticed the same behavior from a downloaded exe created in VS2005 using
the folderbrowser --- thus, I have two indenpent instances of the
browserdialog hanging, one not of my creation.

Any insights?

--
Grumpy Aero Guy



这篇关于FolderBrowserDialog于2005年挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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