Latest: Download Free Desktop Wallpapers of Chef Loony! | Series: AuthorRank? | Download MBT eBooks!

Membantasi Input Karakter pada TEdit

0 komentar

Dear Delphier,

Perlu diketahui bahwa yang termasuk kedalam karakter Heksadesimal adalah:

1. Karakter dari 0..9
2. Karakter dari A..F
3. Karakter dari a..f

Contoh kode program:

...
...
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if not
  (
  ((Key > #48) and (Key <= #57)) or
  ((Key >= #65) and (Key <= #70)) or
  ((Key >= #97) and (Key <= #102)) or
  (Key = #8)
  ) then
  begin
  // Tahan karakter agar tidak dimunculkan
  Key := #0;
  end;
end;
...
...

Dari potongan kode program diatas, bisa terlihat dengan jelas bahwa untuk karakter lebih dari #48 dan kurang dari sama dengan #57 memiliki arti range di interval tersebut. Untuk karakter diluar range tersebut akan diabaikan dengan memberikan notifikasi karakter null atau #0.

Contoh Project:

URL: https://www.facebook.com/download/406442942754950/Membatasi%20karakter%20hanya%20untuk%20Heksadesimal.rar

Semoga FAQ ini bermanfaat dan bisa menambah wawasan anda seputar pemrograman dengan menggunakan Delphi

Tidak ada komentar:

  • MBT Icons and buttons

    Icons and Buttons

    Our resources have been successfully downloaded over 10K times and found almost every where. Get yours!

  • choosing webhost for a blog

    Why HostGator?

    Learn Why we chose HostGator as our Web Host and find discount coupons to kick start your blog today!

  • SEO Settings for blogger

    ALL IN ONE SEO PACK 2012

    Learn every single SEO tip that will boost your blog's ranking and organic traffic. We got them all!

  • Blogger widgets and plugins

    Visit MBT's Blogger LAB

    Why not take a tour of all great Blogger widgets published so far? You Name it we have it!

  • become a six figure blogger!

    Become a SIX FIGURE BLOGGER

    Learn what it takes to become a successful entrepreneur and build a living online!