Ads 468x60px

Selasa, 14 November 2017

Kalkulator Menggunakan Keypress

Tugas 6




Private Sub Command1_Click()
If Val(Text2.Text) & Val(Text3.Text) Then
Text4.Text = Val(Text2.Text) + Val(Text3.Text)
End If

If Val(Text5.Text) & Val(Text6.Text) Then
Text7.Text = Val(Text5.Text) / Val(Text6.Text)
End If

If Val(Text8.Text) & Val(Text9.Text) Then
Text10.Text = Val(Text8.Text) - Val(Text9.Text)
End If

If Val(Text11.Text) & Val(Text12.Text) Then
Text13.Text = Val(Text11.Text) * Val(Text12.Text)
End If
End Sub

Private Sub Command2_Click()
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
Text13.Text = ""
End Sub

Private Sub Command3_Click()
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
Text13.Text = ""
End Sub

Private Sub Command4_Click()
End
End Sub
Private Sub Form_Load()
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
Text13.Text = ""
End Sub

Private Sub Text11_Change()
If KeyAscii = 13 Then
Text12.SetFocus
End If
End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text3.SetFocus
End If

End Sub


Private Sub Text5_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text6.SetFocus
End If
End Sub

Private Sub Text8_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text9.SetFocus
End If
End Sub

Tidak ada komentar:

Posting Komentar

 

Sample text

Sample Text

Sample Text

 
Blogger Templates