PDA

View Full Version : Text to File Listbox Help


byserkann
02-08-2009, 03:50 AM
Hello, I am Projext text to file open and read end.
ADD button Click

Programlar = Input.GetText("Input1");
TextFile.WriteFromString("AutoPlay\\Txt\\ProgramListesi.txt","\r"..Programlar, true);



ListBox.DeleteItem("ListBox1", -1);
-- A while loop
testvar = 0;
while (testvar < 100) do
-- Do something here
testvar = testvar + 1;
ch_name = TextFile.ReadToTable("AutoPlay\\TXT\\ProgramListesi.txt");
ListBox.AddItem("ListBox1", ch_name[testvar]);

end


Code error picture...

Helpp meeee

longedge
02-08-2009, 05:01 AM
On your button try something like -

Programlar = Input.GetText("Input1");
TextFile.WriteFromString("AutoPlay\\Docs\\Text\\ProgramListesi.txt", "\r\n"..Programlar, true);

ListBox.DeleteItem("ListBox1", -1);
Input.SetText("Input1", "");


ch_name = TextFile.ReadToTable("AutoPlay\\Docs\\Text\\ProgramListesi.txt");
if ch_name then
count = Table.Count(ch_name);
for testvar = 1,count do
ListBox.AddItem("ListBox1", ch_name[testvar]);
end
end

byserkann
02-08-2009, 06:34 AM
On your button try something like -

Programlar = Input.GetText("Input1");
TextFile.WriteFromString("AutoPlay\\Docs\\Text\\ProgramListesi.txt", "\r\n"..Programlar, true);

ListBox.DeleteItem("ListBox1", -1);
Input.SetText("Input1", "");


ch_name = TextFile.ReadToTable("AutoPlay\\Docs\\Text\\ProgramListesi.txt");
if ch_name then
count = Table.Count(ch_name);
for testvar = 1,count do
ListBox.AddItem("ListBox1", ch_name[testvar]);
end
end
Thanks And You