Click here to Skip to main content
15,882,163 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Connection with sqlServer Pin
SeLoRBIS27-Jul-05 22:27
SeLoRBIS27-Jul-05 22:27 
GeneralRe: Connection with sqlServer Pin
Rizwan Bashir28-Jul-05 1:19
Rizwan Bashir28-Jul-05 1:19 
GeneralRe: Connection with sqlServer Pin
SeLoRBIS28-Jul-05 4:00
SeLoRBIS28-Jul-05 4:00 
GeneralValidating XML in VB.NET Pin
Anonymous27-Jul-05 4:17
Anonymous27-Jul-05 4:17 
GeneralRe: Validating XML in VB.NET Pin
Briga27-Jul-05 4:36
Briga27-Jul-05 4:36 
GeneralRe: Validating XML in VB.NET Pin
Anonymous27-Jul-05 5:15
Anonymous27-Jul-05 5:15 
Generalfail to save new ATL ActiveX control on VB6 form page Pin
Amos.A27-Jul-05 3:51
Amos.A27-Jul-05 3:51 
GeneralStrange IO.Directory.Move behavior Pin
Brad Fackrell27-Jul-05 3:44
Brad Fackrell27-Jul-05 3:44 
Can anybody tell me why the code below would execute IO.Directory.Move and then re-create the original folder name?
Private Sub renameFolder()
   Dim Prompt As String
   Dim oldFolderName As String
   Dim folderName As String
   Dim selectedPath As String
   Dim newPath As String

   selectedPath = TreeView1.SelectedNode.FullPath ' get the full path of the selected node
   oldFolderName = TreeView1.SelectedNode.Text ' get the name of the selectd node
   Prompt = "Enter the new name for: " & oldFolderName ' ask for the new folder name
   folderName = InputBox(Prompt, "Rename Folder", oldFolderName) ' load the name into the variable 'folderName'
   newPath = selectedPath.Replace(oldFolderName, folderName) ' build the new path by replacing the old name with the new
   IO.Directory.Move(selectedPath, newPath) ' remove the old directory
   TreeView1.SelectedNode.Parent.Nodes.Add(folderName) ' add the new folder to the treeView
   TreeView1.SelectedNode.Remove() ' remove the old node from the tree
End Sub

Let me explain what is happening; When I step through this code with the debugger it seems to execute perfectly. After IO.Directory.Move(selectedPath, newPath) executes, the old folder is gone and the and the new folder is present.

The problem is that as the debugger exits Private Sub renameFolder() the old folder re-appears. At this point the new folder and the old folder are present.

Thanks
Brad
Generalpcmcia card insertion detection Pin
Briga27-Jul-05 3:30
Briga27-Jul-05 3:30 
GeneralRe: pcmcia card insertion detection Pin
Briga27-Jul-05 4:28
Briga27-Jul-05 4:28 
GeneralTransparency within MDI application Pin
oakleaf27-Jul-05 3:19
oakleaf27-Jul-05 3:19 
GeneralRe: Transparency within MDI application Pin
oakleaf27-Jul-05 5:00
oakleaf27-Jul-05 5:00 
GeneralRe: Transparency within MDI application Pin
oakleaf27-Jul-05 7:30
oakleaf27-Jul-05 7:30 
Generalhelp on event handling Pin
bspro27-Jul-05 3:15
bspro27-Jul-05 3:15 
GeneralRe: help on event handling Pin
Briga27-Jul-05 3:42
Briga27-Jul-05 3:42 
GeneralRe: help on event handling Pin
bspro29-Jul-05 21:18
bspro29-Jul-05 21:18 
GeneralDLL Version Information Pin
Nagendra Kamath K27-Jul-05 2:05
Nagendra Kamath K27-Jul-05 2:05 
GeneralRe: DLL Version Information Pin
progload27-Jul-05 12:18
progload27-Jul-05 12:18 
GeneralRe: DLL Version Information Pin
Nagendra Kamath K27-Jul-05 22:15
Nagendra Kamath K27-Jul-05 22:15 
GeneralXML File Creation Pin
Mythri.B.L27-Jul-05 1:25
Mythri.B.L27-Jul-05 1:25 
GeneralRe: XML File Creation Pin
Briga27-Jul-05 3:39
Briga27-Jul-05 3:39 
GeneralXML file creation Pin
Anonymous27-Jul-05 1:23
Anonymous27-Jul-05 1:23 
GeneralUploading a File Pin
Raj_deepak26-Jul-05 23:29
Raj_deepak26-Jul-05 23:29 
GeneralRe: Uploading a File Pin
Dave Kreskowiak27-Jul-05 6:55
mveDave Kreskowiak27-Jul-05 6:55 
GeneralResolving hostname through a proxy server Pin
Fu Manchu26-Jul-05 23:27
Fu Manchu26-Jul-05 23:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.