Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > OOP
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 14-05-2007
Avatar de juangiron
juangiron juangiron is offline
Miembro
 
Registrado: ene 2007
Posts: 26
Poder: 0
juangiron Va por buen camino
PRegunra

hola logre guardar mis objetos que estan almacenados en un array asi:

Código Delphi [-]
procedure TFrmPrincipal.ToolButton14Click(Sender: TObject);
var
  FS: TFileStream;
  I:Integer;
begin
SaveDialog1.Filter:='Archivo XML(*.dat|*.DAT';
if SaveDialog1.Execute then
begin
   try
  FS := nil;
  try
    FS := TFileStream.Create(SaveDialog1.FileName, fmCreate);
    for I := 0 to High(ArrayObjetos) do
       FS.WriteComponent(ArrayObjetos[i].getObjeto);
  finally
    FS.Free;
  end;
  finally
   ShowMessage('Archivo Guardado');
  end;
  end;
end;

pero al hacer la funcion de cargar?

cual seria el Tobjet?

Código Delphi [-]
procedure TFrmPrincipal.ToolButton3Click(Sender: TObject);
var
  FS: TFileStream;
  newO:TObjeto;
  I:Integer;
begin
OpenDialog1.Filter:='Archivo dat(*.dat|*.DAT';
if OpenDialog1.Execute then
begin
   try
  FS := nil;
  try
    FS := TFileStream.Create( OpenDialog1.FileName, fmOpenRead );

   //  for I := 0 to   High(FS) do --> NEcesito hacer un FOR???
     FS.ReadComponent(TObjeto.create);
  finally
    FS.Free;
  end;
   finally

   end;
end;
end;

lo que quiero hacer es leer el archivo y meter estos datos en un array de objetos, debo hacer un for del FS?? como asigno el objeto a mi array para poder acceder a los metodos SET y GET de mi objeto (Tobjeto es mi clase de Objetos, no es igual a TObject)

gracias
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Clase, objeto, tipo? [Gunman] OOP 3 04-01-2006 16:11:32
Como guardar un objeto en un archivo ? cmurua71 OOP 7 18-11-2005 21:26:30
Cargar Objeto Table jzk OOP 2 21-09-2005 12:51:51
Guardar y Cargar un reporte por código... emeceuy Impresión 3 30-12-2004 12:07:16
Controlar eventos de una clase propia keglevich OOP 4 15-09-2004 13:58:21


La franja horaria es GMT +2. Ahora son las 16:40:45.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi