掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
複数のコンポーネントに入力した内容をテキストファイル保存に保存するには? (ID:17316)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
書込にはTStringList、読込にはTMemIniFileを使います。 下記が例です。 implementation uses IniFiles; procedure TForm1.Button1Click(Sender: TObject); var F: TStringList; begin F:= TStringList.Create; try F.Add(Format('[%s]', [ComboBox1.Name])); F.AddStrings(ComboBox1.Items); F.Add(Format('[%s]', [Memo1.Name])); F.AddStrings(Memo1.Lines); F.SaveToFile('c:\test.txt'); finally F.Free; end; end; procedure TForm1.Button2Click(Sender: TObject); var F: TMemIniFile; begin F:= TMemIniFile.Create('c:\test.txt'); try F.ReadSectionValues(ComboBox1.Name, ComboBox1.Items); F.ReadSectionValues(Memo1.Name, Memo1.Lines); finally F.Free; end; end;
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.