Ver Mensaje Individual
  #5  
Antiguo 11-07-2006
oscarpinog oscarpinog is offline
Miembro
 
Registrado: jul 2006
Ubicación: santiago de Chile.
Posts: 18
Reputación: 0
oscarpinog Va por buen camino
pasar valores de variables de un form a otro

Hola, Miren coloco esto... y por mas que le doy vueltas, no me pasa el valor de editabout.text hacia editform1.text.. de hecho me borra el contenido original de editform1 y seria todo...
aca va el codigo:

Código Delphi [-]
// codigo de unit1 (programa principal)
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    Label1: TLabel;
    Editform1: TEdit;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  A,B: String;

implementation

uses about;

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
 frm: Taboutbox;
begin
  frm:= Taboutbox.Create(self);
//  frm.A:= z    ;
//  frm.B:= x    ;

  editform1.text:=frm.A;

  frm.showmodal;
  frm.free;



//aboutbox.ShowModal;
end;

end.

// codigo del about
unit ABOUT;

interface

uses Windows, Classes, Graphics, Forms, Controls, StdCtrls,
  Buttons, ExtCtrls;

type
  TAboutBox = class(TForm)
    Panel1: TPanel;
    OKButton: TButton;
    ProgramIcon: TImage;
    ProductName: TLabel;
    Version: TLabel;
    Copyright: TLabel;
    Comments: TLabel;
    editabout: TEdit;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    Fa, Fb: String;   { Private declarations }
  public
    Property A: String read Fa Write Fa; { Public declarations }
    Property B: String read Fb Write Fb;
  end;

var
  AboutBox: TAboutBox;

implementation

{$R *.dfm}

procedure TAboutBox.Button1Click(Sender: TObject);
begin
A:= editabout.Text ;
end;

end.

Gracias por todo, de verdad se pasaron chiquilllos!

Última edición por dec fecha: 11-07-2006 a las 19:57:55.
Responder Con Cita