Thank You a big help!
I can now write to any type of file that i want (.txt or .bat)
My next problem is reading the contents of the file !?!?
I have written the following contents to the file using :
Code:
Private Sub Form_Click()
Open App.Path & "\Test.Txt" For Output As #1
Print #1, "strUsername = rhys"
Print #1, ""
Print #1, ""
Close #1
End Sub
But my problem lies in the reading of the value of strUsername ... HOW!?
All i want to do is return the value of rhys (and any other value i assign to other strings, variables) but i cant, i have read through the link that
Vadivel gave to me ... but no success..
I have tried :
Code:
Dim TextLine$, Filename$
Dim FileHandle as Integer
Filename$ = "test.txt"
' Test if the file exists
If Dir(Filename$) = "" Then Exit Sub
FileHandle = FreeFile ' This is safer than assigning a number
Open Filename$ For Input As #FileHandle
Do While Not EOF(FileHandle) ' Loop until end of file
Line Input #FileHandle, TextLine$ ' Read line into variable
' Your code here
Loop
Close #FileHandle
but i just dont understand how i do it.
I have also tried :
Code:
Private Sub Command2_Click()
Open App.Path & "\Test.txt" For Input As #1
Input #1, Val(strUsername)
Close #1
End Sub
But returns a variable error or something along those lines
Regards
Rhys