Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alert or Msgox

Status
Not open for further replies.

ksbrace

Programmer
May 13, 2000
501
US
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.

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 & &quot;LT&quot;

                        'if the files have the same Last Modified date ( LastWriteTime ).
                        Else
                            
                            tbSd2.Text = tbSd2.Text & vbCrLf & f1.FullName & &quot;eql&quot;

                        End If
 
This may not be the end all answer, but its worked well for me. For my error messages I just create a panel with a label and a button. The panel starts invisible, if I need to prompt I set the panel to visible and set the label text within the panel to my error message. The button in the panel basically sets visible back to false on the panel when the user clicks ok.

In some cases I bind javascript to buttons to warn form some clicks like...
deleteButton.Attributes(&quot;onclick&quot;) = &quot;javascript:return confirm('Are you sure you want to delete this row?')&quot;
basically in this case though that will happen any time the button is clicked.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top