-
text file question
Hi all,
I have a question i was able to load a textbox value in the text file where text data = " " is . But i want another condition to execute ie.. if there is text box value i want to put value in Message data = " .text " and if not i want to replace it with another value.
the file looks like this
[ Text 1 ]
text data = " "
[text 2 ]
message data = " "
this is the code iam trying with
Dim tmp As String
Dim lines() As String
Dim x As Integer
Open "default.txt" For Binary As #1
tmp = Space(LOF(1))
Get #1, , tmp
Close #1
lines = Split(tmp, vbCrLf)
For x = 0 To UBound(lines)
If lines(x) = "[Text 1]" Then
x = x + 1
Exit For
End If
Next
lines(x) = "Text Data = " & Trim(cusname.Text) & " " & Trim(phone.Text) & " " & Trim(txtitem.Text)
Open "default.txt" For Output As #1
For x = 0 To UBound(lines)
Print #1, lines(x)
Next
Close #1
can anyone help
-
1 Attachment(s)
Re: text file question
Seems as if Ini files could be fine for your purpouse. Or you could use
Random files.
If you still want to deal with it like strings, you can use the following
example :
-
Re: text file question
Thanks a lot guys ,, i got it resolved.
cheers!!!!!!!!!!!!!!!