2011-06-13 95 views
1

我會怎麼做txbroot始終顯示根的值,因爲此刻我依然會顯示我的當前目錄(這是在2010年VB.net)如何使一個文本框始終顯示一個變量的價值

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

不能明白你想要什麼 – Waleed 2011-06-13 00:55:17

+0

基本上,問題是,在代碼運行時通過之前根本的變化是由對話框txbroot.text設置。這意味着txbroot中顯示的文本是當前目錄而不是用戶選擇的目錄 – Kuzon 2011-06-13 00:58:22

回答

1

根做作應的ShowDialog後進行

If .ShowDialog = DialogResult.OK Then 
    root = .SelectedPath 
    txbroot.Text = root 
End If 
+0

謝謝你完美地工作 – Kuzon 2011-06-13 01:05:24

相關問題