|
-
Jan 25th, 2004, 02:22 PM
#1
Thread Starter
Fanatic Member
check of any value exist in a txt file
Is it possible to check if there is any value in a txt.file?
ie: If Open "C:\xxx.txt"= "" then....
what will be the correct expression above?
-
Jan 25th, 2004, 02:26 PM
#2
Frenzied Member
Open the file for reading, read in each line, check for your string, if it exists do your routine, if it it doesnt read the next line. Do until you reach the end of the file.
-
Jan 25th, 2004, 02:36 PM
#3
Thread Starter
Fanatic Member
how do i check for the existence forany string?
i use this:
Get #intFNum, 1, intClickCount
If intClickCount ="" Then
Put #intFNum, 1, 1
Else
intClickCount = intC....
the intClickCount ="" is not correct....how to expression it?
-
Jan 25th, 2004, 02:48 PM
#4
-= B u g S l a y e r =-
VB Code:
Option Explicit
Private Function GetFileContents(fileName As String) As String
If Dir(fileName) <> "" Then
Open fileName For Binary As #1
GetFileContents = Input(LOF(1), 1)
Close #1
End If
End Function
Private Sub Command1_Click()
If InStr(GetFileContents("c:\autoexec.bat"), "data to search for") Then
'do your struff
Else
'doesnt exist... what now
End If
End Sub
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
|