Translate


EnglishFrenchGermanySpainItalianNetherlandsRussian
PortugueseJapaneseKoreanArabicChinese SimplifiedCroatianDanish

Belajar VB 6.0 Headline Animator

19 Januari 2008

Simple Stopwatch Application from VB 6.0

Untuk membuat sebuah aplikasi yang menggunakan control timer satu hal yang perlu diperhatiin atau diketahui yaitu interval yang digunakan. Pada visual basic untuk satu detik nilai interval timernya adalah 1000.

Code program ini bisa kalian coba buat dengan metode perulangan atau looping. Namun pada code ini saya menggunakan "if bersarang". dan saya mencoba membuat sebuah logika yang sederhana yang semoga saja bisa dimengerti.
Berikut tampilan design dan name dari tiap control nya aplikasinya:


Dan berikut adalah coding yang digunakan :

Dim jam, menit, detik, milisec

Private Sub cmdExit_Click()

Timer1.Enabled = False
Timer2.Enabled = False
End

End Sub

Private Sub cmdreset_Click()

'membuat tampilan menjadi 00:00:00:00

lblSecon.Caption = "00"
lblMinute.Caption = "00"
lblHour.Caption = "00"

'pengaturan nilai variabel

jam = "0"
menit = "0"
detik = "0"

End Sub

Private Sub cmdStart_Click()

Timer1.Enabled = True
Timer2.Enabled = True
cmdreset.Enabled = False
cmdStart.Enabled = False
cmdStop.Enabled = True

jam = lblHour.Caption
menit = lblMinute.Caption
detik = lblSecon.Caption

End Sub

Private Sub cmdStop_Click()

Timer1.Enabled = False
Timer2.Enabled = False
cmdreset.Enabled = True
cmdStart.Enabled = True
cmdStop.Enabled = False

End Sub

Private Sub Form_Load()

'pemberian nilai properti interval timer
' interval untuk satu detik sama dengan kuranglebih 1000

Timer1.Interval = 1000
Timer2.Interval = 500

End Sub

Private Sub Timer1_Timer()

detik = detik + 1
If Val(detik) > 59 Then 'fungsi "val" untuk menggubah karakter menjadi angka atau number

detik = "00"
menit = Val(menit) + 1

If Val(menit) > 59 Then

menit = "00"
jam = Val(jam) + 1

If Val(jam) > 23 Then
jam = "00"

End If
End If
End If

d = Len(detik) 'fungsi "len" berguna untuk mengetahui banyak/panjang karakter
If d = 1 Then
lblSecon.Caption = "0" & detik 'membuat tampilan menjadi "0X"
'tanda "&" berfungsi untuk penggabungan karakter
Else
lblSecon.Caption = detik
End If

m = Len(menit)
If m = 1 Then
lblMinute.Caption = "0" & menit
Else
lblMinute.Caption = menit
End If

j = Len(jam)
If j = 1 Then
lblHour.Caption = "0" & jam
Else
lblHour.Caption = jam
End If

End Sub

Private Sub Timer2_Timer()

'Untuk membuat karakter titik dua ( : ) berkedip

Label1.Visible = Not Label1.Visible
Label2.Visible = Not Label2.Visible

End Sub

Untk pengembangannya bisa dicoba menambahkan fasilitas milisecon nya.

15 komentar:

Anonim mengatakan...

Neat blog! Is your theme custom made or did you download it from somewhere?

A theme like yours with a few simple adjustements would really make my blog stand out.

Please let me know where you got your design.
Kudos

Feel free to surf to my web site tumblr.com

Anonim mengatakan...
Komentar ini telah dihapus oleh administrator blog.
Anonim mengatakan...

I am actually pleased to glance at this blog posts which carries plenty of helpful data, thanks for providing
such statistics.

Also visit my web page Http://Www.Bestcoconutoilforhair.Com

Anonim mengatakan...

I got this web site from my pal who shared with me regarding this web site and at the moment this time I am browsing this site and reading very informative articles here.


my website - Unknown

Anonim mengatakan...

I loved as much as you'll receive carried out right here. The sketch is tasteful, your authored subject matter stylish. nonetheless, you command get bought an impatience over that you wish be delivering the following. unwell unquestionably come more formerly again as exactly the same nearly a lot often inside case you shield this increase.

My webpage :: Unknown

Anonim mengatakan...

These are really impressive ideas in on the topic of blogging.
You have touched some fastidious points here. Any way keep up wrinting.


My page :: Unknown

Anonim mengatakan...

This post presents clear idea in favor of the new viewers of
blogging, that truly how to do blogging and site-building.


Visit my web page - Unknown

Anonim mengatakan...

I've been browsing online more than three hours today, yet I never found any interesting article like yours. It's pretty
worth enough for me. Personally, if all webmasters and bloggers made good content as you did, the net will be a lot more useful than ever before.


My website: Diaper Rash Remedies

Anonim mengatakan...

Hello, I would like to subscribe for this weblog to take most up-to-date updates, therefore where
can i do it please help out.

My blog ... Unknown

Anonim mengatakan...

Excellent way of explaining, and pleasant paragraph to get
information on the topic of my presentation subject, which i am going to
convey in academy.

Here is my web blog ... Unknown

Anonim mengatakan...

Hi there, I discovered your website via Google even as searching for a
related topic, your site got here up, it seems good. I've bookmarked it in my google bookmarks.
Hello there, simply was aware of your weblog thru Google, and located that it's truly informative.

I'm gonna be careful for brussels. I will be grateful if you proceed this in future. Lots of folks will probably be benefited from your writing. Cheers!

Take a look at my web-site Psn Code Generator

Anonim mengatakan...

Fine way of explaining, and pleasant article to obtain information concerning my presentation
focus, which i am going to present in institution of higher education.


Feel free to visit my web-site diarrhea Remedies

Anonim mengatakan...

Everyone loves what you guys are up too. This sort of clever work
and reporting! Keep up the excellent works guys I've included you guys to my personal blogroll.

Also visit my blog ... generateur de code psn

Anonim mengatakan...

Hey very nice blog!

Take a look at my blog ... PS3 Jailbreak 4.41

Anonim mengatakan...

It's going to be finish of mine day, however before ending I am reading this enormous post to increase my know-how.

Feel free to visit my weblog ... dry scalp treatments

 
>