Minggu, 04 Agustus 2013

KONVERSI JAM MENGGUNAKAN VISUAL BASIC


Hey guys. Penasaran bagaimana caranya bikin program visual basic untuk melihat sudut terbesar dan sudut terkecil dari jarum jam yang ditunjukan. Lets check it out.

Pertama-tama buat tampilan seperti contoh ddibawah ini
yang digunakan hanya label , textbox dan commandbutton. Tidak ada perubahan pada propertiesnya.

Kemudian, dilanjut dengan kodingnya



Private Sub Command1_Click()
Dim J As Integer
J = Val(Text1)
Dim M As Integer
M = Val(Text2)
Dim A As Integer
A = (30 * J) + (1 / 2 * M)
Dim B As Integer
B = 6 * M

If A > B Then
Text3.Text = A - B
Text4.Text = 360 - Val(Text3)
Else
Text3.Text = B - A
Text4.Text = 360 - Val(Text3)

If Val(Text3) > Val(Text4) Then
If A > B Then
Text4.Text = A - B
Text3.Text = 360 - Val(Text4)
Else
Text4.Text = B - A
Text3.Text = 360 - Val(Text4)
End If
End If
End If
End Sub

Private Sub Command2_Click()
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
End Sub

Private Sub Command3_Click()
End
End Sub

selamat mencoba :)

Tidak ada komentar:

Posting Komentar