|
-
Nov 29th, 2006, 03:11 PM
#1
Thread Starter
Addicted Member
Last edited by om-yousif; Nov 29th, 2006 at 03:19 PM.
-
Nov 29th, 2006, 11:48 PM
#2
Re: search untile empty line
Q1: what is the code you are using to search the .txt file...
If an answer to your question has been helpful, then please, Rate it!
Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.
-
Nov 29th, 2006, 11:58 PM
#3
Hyperactive Member
Re: search untile empty line
For question 1:
VB Code:
Private Sub Form_Load()
Dim data As String
Open "C:\test.txt" For Input As #1
Do While EOF(1) <> True
Line Input #1, data
If Len(Replace(data, " ", "")) = 0 Then Exit Do
Debug.Print data
Loop
Close #1
End Sub
-
Nov 30th, 2006, 04:02 AM
#4
Re: search untile empty line
@Rob123: you'd probably be better using Trim$ for that line:
VB Code:
If Len(Trim$(Data)) = 0 Then Exit Do
-
Nov 30th, 2006, 04:31 AM
#5
Re: search untile empty line
VB Code:
If UCase(Left(tmp(x), 14)) = Text3.Text Then tmp(x) = left(tmp(x), 14) & ">" & mid(tmp(x), 15)
the above should work if you want the whole string with > inserted at that position, if you just want the first part and the > then leave off the mid part
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Nov 30th, 2006, 08:05 AM
#6
Thread Starter
Addicted Member
Re: search untile empty line
hi westconn1
OK this code is adding the char to tmp(x)
i checked that by this code
now how it can be copied to the text file?
-
Nov 30th, 2006, 03:29 PM
#7
Re: search untile empty line
assuming the array tmp is a split of the file you opened and that you just want to overwrite it, then open the same (or other) file for output, join the array and print to file
this is after all substitutions are done, so that you only write to file once
VB Code:
Open myfile For Output As 1
Print #1, Join(tmp, vbNewLine)
Close 1
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Nov 30th, 2006, 03:44 PM
#8
Thread Starter
Addicted Member
Re: search untile empty line
thanks alot westconn1
i've done it
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
|