Newbie Question issue

giga

Well-Known Member
Licensed User
Longtime User
This maybe easy for someone, but I am new at this.

I am trying to write to a file and have preset fields and need to include the user input. I would like the output file to read.


(example)

name=Bob Jones. bob jones being what the user typed in.
address=100 test avenue address being what the user typed in.

I have the file creating but struggling with the name= section before the user input in edittext box.

Can I use a writeline code for this like below?

As always Thanks in advance.:sign0188:

Sub SaveINI
Dim tw As TextWriter
tw.Initialize(File.OpenOutput(DirName, FileName, False))

tw.WriteLine(EditText1.text) ' writes name
tw.WriteLine(EditText2.text) ' writes address
tw.WriteLine(EditText3.text) ' writes city
EditText1.Wrap = False
EditText2.Wrap = False
EditText3.Wrap = False
tw.Close 'Close and make file

End Sub
 

kickaha

Well-Known Member
Licensed User
Longtime User
To add Name= etc at the start of the line:
B4X:
Sub SaveINI
Dim tw As TextWriter
tw.Initialize(File.OpenOutput(DirName, FileName, False))

tw.WriteLine("name=" & EditText1.text) ' writes name 
tw.WriteLine("address=" & EditText2.text) ' writes address 
tw.WriteLine("city=" & EditText3.text) ' writes city 
EditText1.Wrap = False
EditText2.Wrap = False
EditText3.Wrap = False
tw.Close 'Close and make file

End Sub
 
Upvote 0
Top