掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
複数のコンポーネントに入力した内容をテキストファイル保存に保存するには? (ID:17312)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
テキストで扱うとなると各行の頭にインデックスを置いてあげては? ということです。 procedure TForm1.SaveToOneText(path:string); var i:integer; strList:TStringList; begin strList:=TStringList.Create; for i:=0 to ListBox1.Items.Count-1 do strList.Add('1:'+ListBox1.Items.Strings[i]); for i:=0 to ListBox1.Items.Count-1 do strList.Add('2:'+ListBox2.Items.Strings[i]); strList.Add('3:'+Edit1.Text); strList.SaveToFile(path); strList.Free; end; procedure TForm1.LoadFromOneText(path:string); var i:integer; strList:TStringList; str:string; begin ListBox1.Clear; ListBox2.Clear; strList:=TStringList.Create; strList.LoadFromFile(path); for i:=0 to strList.Count-1 do begin str:= strList.Strings[i]; if str[1]='1' then ListBox1.Items.Add(Copy(str,3,Length(str)-2)) else if str[1]='2' then ListBox2.Items.Add(Copy(str,3,Length(str)-2)) else if str[1]='3' then Edit1.Text:= Copy(str,3,Length(str)-2); end; strList.Free; end;
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.