Einzelnen Beitrag anzeigen

rojhat2049

Registriert seit: 20. Nov 2009
Ort: Berlin
7 Beiträge
 
#1

Euro - Dollar - Umrechner

  Alt 21. Nov 2009, 21:28
Hier habe ich einen Euro - Dollar - Umrechner programmiert


Delphi-Quellcode:
unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;
type
  TForm1 = class(TForm)
    edt1: TEdit;
    edt2: TEdit;
    edt3: TEdit;
    grp1: TGroupBox;
    lbl2: TLabel;
    lbl3: TLabel;
    grp2: TGroupBox;
    lbl1: TLabel;
    grp3: TGroupBox;
    scrlbr1: TScrollBar;
    edt4: TEdit;
    procedure edtDblClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure scrlbr1Change(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Form1: TForm1;
implementation
{$R *.dfm}
var
  kurs, euro, dollar :Single;
  code :Integer;
  s :string;
procedure umwandeln;
  begin
    with Form1 do
    begin
      Val(edt1.text, kurs, code) ;
      Val(edt2.Text,dollar , code) ;
      Val(edt3.Text,euro ,code) ;
     end;
    end;
    procedure euro_dollar;
    begin
     umwandeln;
     Str(euro*kurs:8:2,s);
     Form1.edt2.text :=s;
     end;
     procedure dollar_euro;
     begin
       umwandeln;
       Str(dollar/kurs:8:2,s);
       Form1.edt3.text :=s;
       end;
procedure TForm1.edtDblClick(Sender: TObject);
begin
    umwandeln;
    if kurs>0
    then if sender =edt3
         then euro_dollar
         else dollar_euro;
end;
  Mit Zitat antworten Zitat