Ver Mensaje Individual
  #5  
Antiguo 28-12-2005
[Gunman] [Gunman] is offline
Miembro
 
Registrado: dic 2004
Ubicación: Pedreguer.
Posts: 355
Reputación: 20
[Gunman] Va por buen camino
Yo te aconsejo que uses archivos .ini (puedes combinalos con archivos .txt) si hay más de una persona. Un ejemplo tipo agenda:
Archivo lista.ini:
=============
[Pepe]
Apellido='Botella'
Edad=69
Notas='./pepe_botella.txt'
[Jose]
Apellido='Ansar'
Edad=96
Notas='./jose_ansar.txt'
=============

Archivo pepe_botella.txt:
=================================
No hem volem cap, que no estigas borratxo!
=================================

Archivo jose_ansar.txt:
=================================
España va bien!
=================================

Código Delphi [-]
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, IniFiles;

type
  TForm1 = class(TForm)
    ListBox1: TListBox;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Memo1: TMemo;
    procedure FormCreate(Sender: TObject);
    procedure ListBox1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
var
  Lista: TIniFile;
begin
  Lista := TIniFile.Create('.\lista.ini');
  try
    Lista.ReadSections(ListBox1.Items);
  finally
    Lista.Free;
  end;
end;

procedure TForm1.ListBox1Click(Sender: TObject);
var
  Lista: TIniFile;
begin
  if ListBox1.ItemIndex >= 0 then
  Lista := TIniFile.Create('.\lista.ini');
  try
    Edit1.Text := ListBox1.Items.Strings[ListBox1.ItemIndex];
    Edit2.Text := Lista.ReadString(ListBox1.Items.Strings[ListBox1.ItemIndex],'Apellido', '');
    Edit3.Text := IntToStr(Lista.ReadInteger(ListBox1.Items.Strings[ListBox1.ItemIndex],'Edad', 0));
    Memo1.Lines.LoadFromFile(Lista.ReadString(ListBox1.Items.Strings[ListBox1.ItemIndex], 'Notas', './'+Edit1.Text+'_'+Edit2.Text+'.txt'));
  finally
    Lista.Free;
  end;
end;

end.

Tu ya te lo adaptas a tu gusto...
__________________
l2prog.co.nr
Responder Con Cita