Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   formulario con error (https://www.clubdelphi.com/foros/showthread.php?t=48338)

Patricio 21-09-2007 21:23:19

formulario con error
 
Hola gente, tengo el siguiente problema, me aparece el error ...

access violation at address.... in Module......at adress....

el tema es que tengo un formulario, que me permite mostrar un cliente y tambien agregar un cliente........y cuando estoy agregando un cliente es posible que tambien agregue personas relacionadas, para lo cual utilizo el mismo formulario. Es decir q desde 1 formulario se llamaria al mismo formulario....

Ahora lo estoy haciendo asi: cuando quiero llamar al formulario que se puede abrir varias veces hago lo siguiente:

FNuevoNombre:TFUFormularioComun;
begin
FNuevoNombre := TFFormularioComun.create(...);
....
FNuevoNombre.showmodal;
FNuevoNombre.release;

el tema es que en algun momento aleatoriamente me tira el error antes mencionado....estoy haciendo algo mal?
Gracias y espero se entienda

maeyanes 21-09-2007 21:31:15

Hola...

Prueba con algo como esto:

Código Delphi [-]
FNuevoNombre := TFFormularioComun.Create(nil);
try
  FNuevoNombre.ShowModal
finally
  FNuevoNombre.Free
end

Tambien podrías usar la siguiente forma:

Código Delphi [-]
with TFormularioComun.Create(nil) do
  try
    ShowModal
  finally
    Free
  end

Saludos...

Patricio 22-09-2007 15:59:34

lo pruebo...
 
gracias x responder maeyanes, voy a probarlo y te aviso

Patricio 24-09-2007 20:28:17

free o release?
 
Ya q estamos les quisiera preguntar que diferencia hay entre free y release

maeyanes 24-09-2007 20:37:14

Hola...

Haciendo una búsqueda en Google...

Cita:

Empezado por Peter Below (TeamB)
Release is intended to be used from a method of the form itself. It delays the actual
destruction of the form by posting a message to the message queue. This allows code
executed inside the form methods to still access any form members. The form will
get destroyed once the code flow returns to the message loop and the message is
delivered to the form.

Free directly calls the forms destructor, so after the statement returns the form
object is no more. Use Free to destroy a form from outside, Release from inside.


Saludos...

dec 24-09-2007 20:42:03

Hola,

Aquí un artículo de Ian Marteens sobre el método Release(). :)

Patricio 24-09-2007 20:59:09

gracias
 
los voy a mirar gracias x responder


La franja horaria es GMT +2. Ahora son las 08:23:26.

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