Kamis, 08 Desember 2016

Penjumlahan, Pengurangan, Pembagian dan Perkalian Bilangan di Borland Delphi 7

Penjumlahan, Pengurangan, Pembagian dan Perkalian Bilangan di Borland Delphi 7

Penjumlahan Bilangan dalam delphi ??? Penjumlahan bilangan di delphi yaitu penjumlahan bilangan didalam Program yang kita buat seperti hal nya kalkulator. Kira-kira ada tau tidak gimana cara nya??? untuk yang belum tau saya kasih tau deh.... Open Delphi ANDA !!! Berikut ini saya kasih tutorialnya Penjumlahan, Pengurangan, Pembagian dan Perkalian .

Seperti Gambar dibawah ini :










Tutorial Penjumlahan Di delphi

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, acProgressBar, StdCtrls, sLabel, sEdit, ExtCtrls,
  sPanel, sSkinProvider, sSkinManager, sStatusBar, sBevel;

type
  TForm1 = class(TForm)
    sSkinManager1: TsSkinManager;
    sSkinProvider1: TsSkinProvider;
    sPanel1: TsPanel;
    sEdit1: TsEdit;
    sLabelFX1: TsLabelFX;
    sEdit2: TsEdit;
    sProgressBar1: TsProgressBar;
    sEdit3: TsEdit;
    sStatusBar1: TsStatusBar;
    sLabelFX2: TsLabelFX;
    sBevel1: TsBevel;
    procedure sEdit2KeyPress(Sender: TObject; var Key: Char);
    procedure sEdit1KeyPress(Sender: TObject; var Key: Char);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.sEdit2KeyPress(Sender: TObject; var Key: Char);
var
bil1,bil2,hsl:integer;
begin
  if (Key > Chr(47)) and (Key < Chr(58)) or (Key = Chr(13)) or (Key = Chr(8)) then 
  else
  Key := Chr(0);
  begin
if key=#13 then
begin
bil1:=strtoint(sedit1.Text);
bil2:=strtoint(sedit2.Text);
hsl:=bil1+bil2;
sedit3.Text:=inttostr(hsl);
end;
end;
end;

procedure TForm1.sEdit1KeyPress(Sender: TObject; var Key: Char);
begin
  if (Key > Chr(47)) and (Key < Chr(58)) or (Key = Chr(13)) or (Key = Chr(8)) then 
  else
  Key := Chr(0);
  begin
if key=#13 then
begin
Sedit2.SetFocus;
end;
end;
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Application.Terminate;
end;

end.

Tutorial Pengurangan di Delphi

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, sStatusBar, acProgressBar, StdCtrls, sEdit, ExtCtrls,
  sBevel, sLabel, sPanel, sSkinProvider, sSkinManager;

type
  TForm1 = class(TForm)
    sSkinManager1: TsSkinManager;
    sSkinProvider1: TsSkinProvider;
    sPanel1: TsPanel;
    sLabelFX1: TsLabelFX;
    sLabelFX2: TsLabelFX;
    sBevel1: TsBevel;
    sEdit1: TsEdit;
    sEdit2: TsEdit;
    sProgressBar1: TsProgressBar;
    sEdit3: TsEdit;
    sStatusBar1: TsStatusBar;
    procedure sEdit1KeyPress(Sender: TObject; var Key: Char);
    procedure sEdit2KeyPress(Sender: TObject; var Key: Char);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.sEdit1KeyPress(Sender: TObject; var Key: Char);
begin
  if (Key > Chr(47)) and (Key < Chr(58)) or (Key = Chr(13)) or (Key = Chr(8)) then 
  else
  Key := Chr(0);
  begin
if key=#13 then
begin
Sedit2.SetFocus;
end;
end;
end;

procedure TForm1.sEdit2KeyPress(Sender: TObject; var Key: Char);
var
bil1,bil2,hsl:integer;
begin
  if (Key > Chr(47)) and (Key < Chr(58)) or (Key = Chr(13)) or (Key = Chr(8)) then 
  else
  Key := Chr(0);
  begin
if key=#13 then
begin
bil1:=strtoint(sedit1.Text);
bil2:=strtoint(sedit2.Text);
hsl:=bil1-bil2;
sedit3.Text:=inttostr(hsl);
end;
end;
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Application.Terminate;
end;

end.

Tutorial Pembagian di Delphi

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, sStatusBar, acProgressBar, StdCtrls, sEdit, ExtCtrls,
  sBevel, sLabel, sPanel, sSkinProvider, sSkinManager;

type
  TForm1 = class(TForm)
    sSkinManager1: TsSkinManager;
    sSkinProvider1: TsSkinProvider;
    sPanel1: TsPanel;
    sLabelFX1: TsLabelFX;
    sLabelFX2: TsLabelFX;
    sBevel1: TsBevel;
    sEdit1: TsEdit;
    sEdit2: TsEdit;
    sProgressBar1: TsProgressBar;
    sEdit3: TsEdit;
    sStatusBar1: TsStatusBar;
    procedure sEdit1KeyPress(Sender: TObject; var Key: Char);
    procedure sEdit2KeyPress(Sender: TObject; var Key: Char);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.sEdit1KeyPress(Sender: TObject; var Key: Char);
begin
  if (Key > Chr(47)) and (Key < Chr(58)) or (Key = Chr(13)) or (Key = Chr(8)) then 
  else
  Key := Chr(0);
  begin
if key=#13 then
begin
Sedit2.SetFocus;
end;
end;
end;

procedure TForm1.sEdit2KeyPress(Sender: TObject; var Key: Char);
var
bil1,bil2,hsl:Real;
begin
  if (Key > Chr(47)) and (Key < Chr(58)) or (Key = Chr(13)) or (Key = Chr(8)) then 
  else
  Key := Chr(0);
  begin
if key=#13 then
begin
If sedit2.Text='0' then
begin
Sedit3.Text:='Cannot Devide by Zero';
end
else
begin
bil1:=StrToFloat(sedit1.Text);
bil2:=StrToFloat(sedit2.Text);
hsl:=(bil1/bil2);
sedit3.Text:=FloatToStr(hsl);
end;
end;
end;
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Application.Terminate;
end;

end.

Tutorial Perkalian di Delphi

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, sStatusBar, acProgressBar, StdCtrls, sEdit, ExtCtrls,
  sBevel, sLabel, sPanel, sSkinProvider, sSkinManager;

type
  TForm1 = class(TForm)
    sSkinManager1: TsSkinManager;
    sSkinProvider1: TsSkinProvider;
    sPanel1: TsPanel;
    sLabelFX1: TsLabelFX;
    sLabelFX2: TsLabelFX;
    sBevel1: TsBevel;
    sEdit1: TsEdit;
    sEdit2: TsEdit;
    sProgressBar1: TsProgressBar;
    sEdit3: TsEdit;
    sStatusBar1: TsStatusBar;
    procedure sEdit1KeyPress(Sender: TObject; var Key: Char);
    procedure sEdit2KeyPress(Sender: TObject; var Key: Char);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.sEdit1KeyPress(Sender: TObject; var Key: Char);
begin
  if (Key > Chr(47)) and (Key < Chr(58)) or (Key = Chr(13)) or (Key = Chr(8)) then 
  else
  Key := Chr(0);
  begin
if key=#13 then
begin
Sedit2.SetFocus;
end;
end;
end;

procedure TForm1.sEdit2KeyPress(Sender: TObject; var Key: Char);
var
bil1,bil2,hsl:Real;
begin
  if (Key > Chr(47)) and (Key < Chr(58)) or (Key = Chr(13)) or (Key = Chr(8)) then 
  else
  Key := Chr(0);
  begin
if key=#13 then
begin
bil1:=StrToFloat(sedit1.Text);
bil2:=StrToFloat(sedit2.Text);
hsl:=(bil1*bil2);
sedit3.Text:=FloatToStr(hsl);
end;
end;
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Application.Terminate;
end;

end

Tidak ada komentar:

Posting Komentar

Cara menginstal quick report di Delphi 7

Cara menginstal quick report di Delphi 7 ... Untuk membuat report atau laporan dari sebuah aplikasi database maka diperlukan suatu tool...