Hello,
I have a situation where I am comparing two directories when I compare the same file from different directories, I need to prompt the user if the date modified is different. I tried using MsgBox but that doesn't work. This is not happening on a button click, it happens when 2 files that are the same, but one has been modified more recently than the other. Any help would be greatly appreciated. thanks in advance! Here is the block of code that I am working on. In the conditional is where I need to prompt the user.
I have a situation where I am comparing two directories when I compare the same file from different directories, I need to prompt the user if the date modified is different. I tried using MsgBox but that doesn't work. This is not happening on a button click, it happens when 2 files that are the same, but one has been modified more recently than the other. Any help would be greatly appreciated. thanks in advance! Here is the block of code that I am working on. In the conditional is where I need to prompt the user.
Code:
' setting the full path to the FileInfo objects.
Dim f1 As New FileInfo(dir1Path & "\" & ListDir1.Item(d1Indx))
Dim f2 As New FileInfo(dir2Path & "\" & ListDir2.Item(d2Indx))
'if the f1 file is newer than f2 file.
If f1.LastWriteTime.CompareTo(f2.LastWriteTime) > 0 Then
'need to prompt user to decide which file to overwrite.
tbSd2.Text = tbSd2.Text & vbCrLf & f1.FullName & "Gt"
'if the f2 file is newer than f1 file.
ElseIf f1.LastWriteTime.CompareTo(f2.LastWriteTime) < 0 Then
'need to prompt user to decide which file to overwrite.
tbSd2.Text = tbSd2.Text & vbCrLf & f2.FullName & "LT"
'if the files have the same Last Modified date ( LastWriteTime ).
Else
tbSd2.Text = tbSd2.Text & vbCrLf & f1.FullName & "eql"
End If