Home > Products > CSHTMLDiff Control > Documentation > User Guide

ExchangeFiles
Previous  Top  Next


 
Exchanges the between Base file and the Revised file, optionally re-calculates the Diff operation.  
 
Syntax  
 
   Sub ExchangeFiles([Refresh As Boolean = True])  
 
Parameters  
 
   Refresh  
Optional. Specifies whether DoDiff should be called automatically. If True (default), DoDiff will be called automatically for the exchanged files. If False, the operation will not have any effect until the next DoDiff.  
     
Remarks  
 
Performs a Diff operation between 2 given streams. Both input streams and output stream are declared as strings, and may contain text control characters - as if the streams were textually read from a file.  
 
Example  
 
Private Sub DiffStreams_Click()  
   ' the following snippet simulates a call to DiffFiles:  
   Const ForReading = 1, ForWriting = 2, ForAppending = 8   
   Dim fso, f  
   Dim strBase As String  
   Dim strRev As String  
   Dim strResult As String  
 
   ' read from input files.  
   Set fso = CreateObject("Scripting.FileSystemObject")   
   Set f = fso.OpenTextFile("C:\LastWeek\Report.html", ForReading)   
   strBase = f.ReadAll   
   f.Close  
   Set f = fso.OpenTextFile("C:\ThisWeek\Report.html", ForReading)   
   strRev = f.ReadAll   
   f.Close  
     
   ' perform a diff and write the output to a file.  
   diffCtrl1.DoDiffStreams strBase, strRev  
     
   Set f = fso.OpenTextFile("C:\Reports\Output.html", ForWriting, True)   
   f.Write strResult   
   f.Close  
End Sub  
 
See Also  
 
   DoDiff, DiffFiles, Diff Specification