有两个控件,一个listbox控件,一个memo控件,memo里面输入信息后,点击确定,把memo控件里的内容写入listbox,现在的问题就是可以写入listbox,但是重启后,listbox里面是空的,我想做的是能把写入的信息保存下来!请问该怎么做啊?
我的代码如下:
procedure TForm6.Button3Click(Sender: TObject);
var
notice: string;
begin
notice:=memo1.Lines.GetText;
login.Form1.ListBox1.Clear;
login.Form1.ListBox1.Items.Text:=notice;
end;
我的代码如下:
procedure TForm6.Button3Click(Sender: TObject);
var
notice: string;
begin
notice:=memo1.Lines.GetText;
login.Form1.ListBox1.Clear;
login.Form1.ListBox1.Items.Text:=notice;
end;
Memo1.SaveToFile('D:\1.txt');程序加载时写Memo1.LoadFormFile('D:\1.txt'); 不知道是这不这样写的这个方法,不太记得了。总之就是在程序退出前保存Memo1的内容在硬盘里,
程序加载时就
加载1.txt到Memo1里。
直接可以使用LoadFromFile加载的,关闭的时候保存到文件
启动的时候,直接文件读取