Monday, October 17, 2011

Membuat Calculator Penghitung sin,cos,tan,log,atan dan akar kuadrat


Yang pertama buatlah menu tampilan seperti gambar berikut ini yang isinya antara lain :














1.  8 buah command button

2.  2 buah textbox

3.  2 buah label

4.  1 buah frame

Setelah itu masukan kode berikut ini :

Private Sub Command1_Click()
MsgBox (Math.Cos(t1.Text))
End Sub

Private Sub Command2_Click()
MsgBox (Math.Sin(t1.Text))
End Sub

Private Sub Command3_Click()
MsgBox (Math.Tan(t1.Text))
End Sub

Private Sub Command4_Click()
MsgBox (Math.Log(t1.Text))
End Sub

Private Sub Command5_Click()
MsgBox (Math.Sqr(t1.Text))
End Sub

Private Sub Command6_Click()
MsgBox (Math.Atn(t1.Text))
End Sub

Private Sub Command7_Click()
Frame1.Visible = True
End Sub

Private Sub Command8_Click()
Frame1.Visible = False
End Sub

Private Sub Form_Load()
t1.Text = "0"
Text1.Text = Time
Frame1.Visible = False
End Sub

Private Sub Form_Unload(Cancel As Integer)
Do
Me.Top = Me.Top + 40
Me.Move Me.Left, Me.Top
DoEvents
Loop Until Me.Top > Screen.Height - 500
End Sub

Nah tinggal di run aja….
Selamat mencoba!!!!

silahkan Download program vb nya disini

No comments:

Post a Comment