|
-
Nov 29th, 2000, 05:56 PM
#1
Thread Starter
Member
I need to create and append a logfile in my application.
It needs to record information from a textbox containing the date and time and also the Username (another txt box).
This file i believe needs to utilise the append command as it shoudl be ongoing not refreshing.
Any help is more than appreciated as this is my final bug bear in a rather tidy security application.
Regards
Morpheus.
-
Nov 29th, 2000, 06:12 PM
#2
I do not understand your question. Did you need help with how to save the file? If so:
Code:
Open "Log" For Append As #1
Print #1, txtDate, txtUserName
Close #1
-
Nov 29th, 2000, 06:28 PM
#3
Thread Starter
Member
Thanks for the heads up Megatron, i was 90 % the way there with it, just needed to change open to append.
NB; Excellent Nick.
Thankyou.
m.
-
Nov 29th, 2000, 06:29 PM
#4
_______
<?>
[code]
' just in case you have not useed this before,
' don't forget to use the file path
Open "FilePath\Log.txt" For Append As #1
Print #1, txtDate, txtUserName
Close #1
[code]
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Aug 19th, 2002, 05:26 AM
#5
Lively Member
Is it also possible delete the first x-lines in a logfile?
-
Aug 19th, 2002, 05:36 AM
#6
VB Code:
Private Sub Command1_Click()
Dim strFileText As String
Open "C:\Path\LogFile.txt" For Append As #1
[color=green] 'Loop throught the current file lines saving them to a string.[/color]
Do While Not EOF(1)
strFileText = strFileText & Input(LOF(1), 1)
Loop
[color=green] ' Write out the textbox values to the file.[/color]
Print #1, "Record Created: " & txtDateTime.Text & _
" By: " & txtUserName.Text & vbCrLf
[color=green] 'Followed by the original file's text.[/color]
Print #1, strFileText
Close #1
End Sub
-
Aug 19th, 2002, 05:38 AM
#7
Deju, just take out all of the lines in my sample code which have "strFileText" in them & the entry written to the file will replace the text which is already there.
-
Aug 19th, 2002, 05:40 AM
#8
Lively Member
Is it also possible the check the filesize? For instance is a file is > 1MB then clean it.
-
Aug 19th, 2002, 05:51 AM
#9
Take a look at the GetFileSize API call either by searching the API forum or on www.allapi.net.
-
Aug 19th, 2002, 05:57 AM
#10
Frenzied Member
Deju alive and kicking
Originally posted by Deju
Is it also possible the check the filesize? For instance is a file is > 1MB then clean it.
And did you find it ??
Code:
If Question = Incomplete Then
AnswerNextOne
Else
ReplyIfKnown
End If
cu Swatty
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|