Click here to Skip to main content
16,011,647 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: DataGridView RecordSource on same instance of MDI Child Pin
infothegdc2-Mar-06 7:37
infothegdc2-Mar-06 7:37 
GeneralRe: DataGridView RecordSource on same instance of MDI Child Pin
GetFree123GetFree2-Mar-06 9:41
GetFree123GetFree2-Mar-06 9:41 
GeneralRe: DataGridView RecordSource on same instance of MDI Child Pin
infothegdc2-Mar-06 13:43
infothegdc2-Mar-06 13:43 
Questionreading data samples from sound card Pin
t4ure4n2-Mar-06 6:25
t4ure4n2-Mar-06 6:25 
GeneralRe: reading data samples from sound card Pin
Guffa2-Mar-06 8:44
Guffa2-Mar-06 8:44 
AnswerRe: reading data samples from sound card Pin
Mujtaba812-Mar-06 11:18
Mujtaba812-Mar-06 11:18 
QuestionCopy all files and folders Pin
dptalt2-Mar-06 6:16
dptalt2-Mar-06 6:16 
AnswerRe: Copy all files and folders Pin
RJGCarey2-Mar-06 7:36
RJGCarey2-Mar-06 7:36 
I found this on the web a few years ago. I do not remember where.

Private Sub CopyDirectory(ByVal SourcePath As String, ByVal DestPath As String, _
Optional ByVal Overwrite As Boolean = False)
Dim SourceDir As DirectoryInfo = New DirectoryInfo(SourcePath)
Dim DestDir As DirectoryInfo = New DirectoryInfo(DestPath)

' the source directory must exist, otherwise throw an exception
If SourceDir.Exists Then
' if destination SubDir's parent SubDir does not exist throw an exception
If Not DestDir.Parent.Exists Then
Throw New DirectoryNotFoundException _
("Destination directory does not exist: " + DestDir.Parent.FullName)
End If

If Not DestDir.Exists Then
DestDir.Create()
End If
' copy all the files of the current directory
Dim ChildFile As FileInfo
For Each ChildFile In SourceDir.GetFiles()
If Overwrite Then
ChildFile.CopyTo(Path.Combine(DestDir.FullName, ChildFile.Name), True)
Else
' if Overwrite = false, copy the file only if it does not exist
' this is done to avoid an IOException if a file already exists
' this way the other files can be copied anyway...
If Not File.Exists(Path.Combine(DestDir.FullName, ChildFile.Name)) Then
ChildFile.CopyTo(Path.Combine(DestDir.FullName, ChildFile.Name), _
False)
End If
End If
Next

' copy all the sub-directories by recursively calling this same routine
Dim SubDir As DirectoryInfo
For Each SubDir In SourceDir.GetDirectories()
CopyDirectory(SubDir.FullName, Path.Combine(DestDir.FullName, SubDir.Name), Overwrite)
Next
Else
Throw New DirectoryNotFoundException("Source directory does not exist: " + SourceDir.FullName)
End If
End Sub

The recursive call is a bit confusing but this has copied my list of directories every night for at least two years.
Should solve your porbelm also.
RCarey

RCarey
QuestionVB.net and Access MDW Pin
Goran Djuric2-Mar-06 6:06
Goran Djuric2-Mar-06 6:06 
AnswerRe: VB.net and Access MDW Pin
infothegdc2-Mar-06 13:24
infothegdc2-Mar-06 13:24 
GeneralRe: VB.net and Access MDW Pin
Goran Djuric2-Mar-06 17:30
Goran Djuric2-Mar-06 17:30 
QuestionOpening files (not EXEs) using appropriate programs Pin
RevathiRajaGopal2-Mar-06 5:29
RevathiRajaGopal2-Mar-06 5:29 
AnswerRe: how can i get summary properties of a video file on my desktop through c# code Pin
J4amieC2-Mar-06 4:38
J4amieC2-Mar-06 4:38 
QuestionPassing parameters to a Crystal Report via VB.Net Pin
directred2-Mar-06 4:21
directred2-Mar-06 4:21 
QuestionException Management in Enterprise Library Pin
dlarkin772-Mar-06 3:39
dlarkin772-Mar-06 3:39 
QuestionMaking a service cluster aware Pin
UniBond2-Mar-06 3:36
UniBond2-Mar-06 3:36 
AnswerRe: Making a service cluster aware Pin
Dave Kreskowiak2-Mar-06 8:39
mveDave Kreskowiak2-Mar-06 8:39 
QuestionHow can i use directsound to record voice in vb.net? Pin
devang_bison2-Mar-06 2:05
devang_bison2-Mar-06 2:05 
AnswerRe: How can i use directsound to record voice in vb.net? Pin
Alex Hoffenreich4-Apr-06 0:43
Alex Hoffenreich4-Apr-06 0:43 
Questionis it wrong? Pin
pandapatin2-Mar-06 0:52
pandapatin2-Mar-06 0:52 
AnswerRe: is it wrong? Pin
Ingo2-Mar-06 2:48
Ingo2-Mar-06 2:48 
AnswerRe: is it wrong? Pin
albCode2-Mar-06 3:05
albCode2-Mar-06 3:05 
GeneralRe: is it wrong? Pin
pandapatin2-Mar-06 3:14
pandapatin2-Mar-06 3:14 
GeneralRe: is it wrong? Pin
albCode2-Mar-06 3:30
albCode2-Mar-06 3:30 
GeneralRe: is it wrong? Pin
pandapatin2-Mar-06 4:04
pandapatin2-Mar-06 4:04 

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.