【发布时间】:2011-06-13 00:30:02
【问题描述】:
如何让 txbroot 始终显示 root 的值,因为此时我仍会显示当前目录(这是在 VB.net 2010 中)
Private Sub btnrootbrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnrootbwse.Click
' Creates a FolderBrowserDialog object
Dim fbdroot As New FolderBrowserDialog
'Dialog
With fbdroot
' Desktop is the root folder in the dialog.
.RootFolder = Environment.SpecialFolder.Desktop
' Select the C:\Windows directory on entry.
.SelectedPath = CurDir()
' Prompt the user with a custom message.
.Description = "Please Select Root Of Sever"
root = .SelectedPath
If .ShowDialog = DialogResult.OK Then
txbroot.Text = root
End If
End With
End Sub
【问题讨论】:
-
不明白你到底想要什么
-
基本上,问题是当代码运行并且 txbroot.text 在 root 被对话框更改之前设置。这意味着txbroot中显示的文本是当前目录而不是用户选择的目录
标签: .net windows vb.net textbox