Apr 19
Bagaimana mencari atau selection pada Delphi, berikut contoh di bawah ini menggunakan ekspresi “IF ELSE”
Case-nya : Bagaimana menentukan Hari Berdasarkan Bilangan yang di input ?
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
nilai: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
if nilai.text=’1? then
begin
label2.Caption:=’Senin’;
end
else if nilai.text=’2? then
begin
label2.Caption:=’Selasa’;
end
else if nilai.text=’3? then
begin
label2.Caption:=’Rabu’;
end
else if nilai.text=’4? then
begin
label2.Caption:=’Kamis’;
end
else if nilai.text=’5? then
begin
label2.Caption:=’Jumat’;
end
else if nilai.text=’6? then
begin
label2.Caption:=’Sabtu’;
end
else if nilai.text=’7? then
begin
label2.Caption:=’Minggu’;
end else
label2.Caption:=’Inputan anda Salah !’;
end;
end.
SCREENSHOOT BELOW :

- Follow us on Twitter, or subscribe to the rizqtech RSS Feed for more daily web development and articles.
Enjoy this Post!


April 27th, 2009 at 3:24 am
[...] Post sebelumnya kita sudah coba menggunakan Selection pada Delphi utk menentukan Hari , Let’s try utk [...]