TCSCode
asked on
Read/Save contents of 2 Listboxs, 2 Memos to one file.
Hi,
How can i get my program to to save all the settings in one file? but i have 2 sections i want to reload
when i click on the title of a listbox.
For example:
Listbox1 line 1 has : "Hello World"
Memo1 has : "Hello to the world"
Listbox2 Line 2 has : "Yard Sale"
Memo1 has : "Yard sale friday at 8:00am"
So if i have "Hello World" selected in the listbox1 I want Memo1 to show "Hello to the world" without
quotes of course or if i have "Yard Sale" selected I would like it to show "Yard Sale friday at 8:00am"
When i close or open my program, I want it to save/load it to one file or load it from that file to
do the above!
When I load my program I would like to click on "Hello World" and "Yard Sale" and have memo1 display
the text that was saved on exit.
I will give more points if needed thank's
How can i get my program to to save all the settings in one file? but i have 2 sections i want to reload
when i click on the title of a listbox.
For example:
Listbox1 line 1 has : "Hello World"
Memo1 has : "Hello to the world"
Listbox2 Line 2 has : "Yard Sale"
Memo1 has : "Yard sale friday at 8:00am"
So if i have "Hello World" selected in the listbox1 I want Memo1 to show "Hello to the world" without
quotes of course or if i have "Yard Sale" selected I would like it to show "Yard Sale friday at 8:00am"
When i close or open my program, I want it to save/load it to one file or load it from that file to
do the above!
When I load my program I would like to click on "Hello World" and "Yard Sale" and have memo1 display
the text that was saved on exit.
I will give more points if needed thank's
ASKER
Hi mnasman,
I would like to save all data in a stream, any ideas?
I would like to save all data in a stream, any ideas?
I think you asked this question before, and you got answer
why u dont' use the same answer?
here's the same question with answer
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20121469
why u dont' use the same answer?
here's the same question with answer
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20121469
ASKER
Hi mnasman,
Yes TomasHelgi did infact answer but since i had a hd crash, i have tryied to get the code togather but i am lost and still trying to figure it out.... or i would'nt have asked the same question over again.
Yes TomasHelgi did infact answer but since i had a hd crash, i have tryied to get the code togather but i am lost and still trying to figure it out.... or i would'nt have asked the same question over again.
why u don't try to use database, it's better for you storing and retrieving the data, you can easily add, delete or search in the database with few lines, fast way
ASKER
I don't want to use bde databse.. to many files to install to run.
you can use ADO, it's not require BDE, and if you have win2000 or 98/Me, will not require any files, but maybe it's need Mdac library from microsoft, to install in the system for only one time, and then u can use the database like access that u can store many data, images, files and more
to use ADO you need to have at least Delphi 5 enterprize edition
to use ADO you need to have at least Delphi 5 enterprize edition
ASKER
I only have Delphi 4.0..
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok Great... my email is hyperon@eudoramail.com
ASKER
Thank's Again...
button1 to add from edit1 to listbox1
button2 to save the text for select item in listbox with it's text in memo to the file, all that will store in one file, when u run the program it will load all the data
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls,Inifiles;
type
TForm1 = class(TForm)
Button1: TButton;
ListBox1: TListBox;
Edit1: TEdit;
Memo1: TMemo;
Button2: TButton;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure ListBox1Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
MyFile : TIniFile;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
MyFile := TIniFile.Create('c:\data.t
MyFile.ReadSections(ListBo
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
MyFile.Free;
end;
procedure TForm1.ListBox1Click(Sende
begin
Memo1.Text := MyFile.ReadString(ListBox1
end;
procedure TForm1.Button1Click(Sender
begin
ListBox1.Items.Add(Edit1.T
end;
procedure TForm1.Button2Click(Sender
begin
MyFile.WriteString(ListBox
end;
end.