I in vb to write a small tool, run the following code is used to implement the records into *. The log file, but found that the program runs very fast, a lot of entries without saving, especially when program debugging error, a operation record can only be written on the part of: could you tell me how to handle this, The output of the log file:
Module1:
'* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * log records * * * * * * * * * * * * * * * * * Start * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * The Public Function openLogfile () Dim F As String 'the nStr=Format (Now, "yyyy - mm - dd hh: mm: ss") & amp; NStr F=App. Path & amp; "\ log " & amp; Format (Now, "yyyymmddhhmmss") & amp; "Log", " 'if you want to save the file to the same folder as your exe, on the other to F=App. The Path & amp; "\ myprog log" H=FreeFile On the Error Resume Next The Open F For Append As # H End the Function The Public Function MyLog (nStr As String) Print # H, the Format (Now, "yyyy - mm - dd hh: mm: ss") Print # H, nStr End the Function The Public Function logfileClose () Close # H The Set H=Nothing Set the log=Nothing 'release logging variables End the Function
log="' TrayNofound query tray corresponding class conditions, and show the sninfo (1) in the Sql=" & amp; SQL Call MD2. MyLog (log) 'writing log
CodePudding user response:
Your code above line 18 (dislocation line number, but 18 told me that line a little "to be neatly") would be is not an error?
Visible your code isn't correct, I don't understand your line 13, 14 lines how can "the data is written to the file,"
In your opening the "logging" module, write down this sentence, and then modify the code, can "fully compile operation" to say again!!!!!! Option Explicit