Hi All,
I re-create a new widget (Attached File too). My problem is Thread 's name. Here you are my source code English version. Please help me to correct them. I use more 3 months ,I cann't make it complete. I'm sorry ,I'm not good at English.
I couldn't run your application but I think the problem may be with the use of DirDefaultExternal which is read only
Try to replace it with DirRootExternal.
I didn't have enough time to check the entire code but in the section of adding a new record (btnkeep_click) you should remove the crlf from this IF:
B4X:
If File.Exists(File.DirDefaultExternal,"Text1.txt") Then
Dim Writer As TextWriter
Writer.Initialize(File.OpenOutput(File.DirDefaultExternal,"Text1.txt",True))
Writer.WriteLine(TxtRRName.Text & "," & TxtUUPrice.Text )
' a problem was here, in writeLine.
'You used crlf, thus inserting an empty line.
'Thus, when you were reading from this file,
'an error was produced because
'a 'comma' could not be found in this empty line.
Writer.Close
End If
Did you replace your txt file with the old one? If not, surely this error will still occure, since it contains the blank lines. Place a copy of your old file in the directory you prefer, and give it another try
Did you replace your txt file with the old one? If not, surely this error will still occure, since it contains the blank lines. Place a copy of your old file in the directory you prefer, and give it another try
Hi mc73,
Thank you for kind of you. I 've a new problem. I replace all text1.txt to text2.txt for make sure text2.txt doesn't t cantain the blank lines. It's right,it has no error occurred ,but after I insert a new data and save it,text2.txt is not change,it wil change after re-insert again. Why not my widget ,it save the first time?
Your original text.txt file, was not finishing with a carriage return, thus, the first time you begin your app, the new line is not appended as new line, but as a continuation of the last line of your file. You should edit your original text.txt by pressing 'enter' at the end of it, and then save it, before uploading it to your dirroot or dirdefault or whatever folder you choose. One good way to debug such cases is to open your edited file by another editor. This way you can see what went wrong.
Your original text.txt file, was not finishing with a carriage return, thus, the first time you begin your app, the new line is not appended as new line, but as a continuation of the last line of your file. You should edit your original text.txt by pressing 'enter' at the end of it, and then save it, before uploading it to your dirroot or dirdefault or whatever folder you choose. One good way to debug such cases is to open your edited file by another editor. This way you can see what went wrong.
Hi mc73,
If I edit original text.txt file with press 'enter' at the end of it and then save it,it will make the blank line.
Whenever I run the widget,it have error occurred again.
did you hit 'enter' exactly at the end of 'ccc,30' ? I suspect you hit enter in a new line. please check this because when I test it, it causes no error.