我如何让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
答案 0 :(得分:1)
应该在ShowDialog
之后执行root做法If .ShowDialog = DialogResult.OK Then
root = .SelectedPath
txbroot.Text = root
End If