TUTORIAL
PROGRAM
APLIKASI KALKULATOR
1. Deskripsi
Program yang kami buat ini adalah program
kalkulator yang dapat digunakan untuk menghitung penghitungan aritmatika
sederhana.
2. Tujuan dan
Manfaat
Tujuan dari program ini adalah pengaplikasian ilmu
dari praktikum yang diberikan oleh asistan-asistan dan mengetahui penghitungan
aritmatika.
3. Sasaran
Pelajar pendidikan yang ingin menggunakan
kalkulator sebagai alat penghitung aritmatika.
Langkah-Langkahnya :
1. Bukalah program Visual Basic 2010 pada komputer Anda.
2.
Isilah Setiap Form dan Listingnya seperti yang dibawah
ini.
No
|
Komponen
|
Properties
|
keterangan
|
1
|
Form1
|
Name
|
Form1
|
Text
|
Kalkulator
|
||
Background
|
WindowsApplication1.My.Resources.Resources.a
|
||
Display
|
CentertoScreen
|
||
2
|
TextBox1
|
Name
|
TextBox1
|
Text
|
|
||
3
|
TextBox2
|
Name
|
TextBox2
|
Text
|
|
||
4
|
Button1
|
Name
|
Button1
|
Text
|
1
|
||
5
|
Button2
|
Name
|
Button2
|
Text
|
2
|
||
6
|
Button3
|
Name
|
Button3
|
Text
|
3
|
||
7
|
Button4
|
Name
|
Button4
|
Text
|
4
|
||
8
|
Button5
|
Name
|
Button5
|
Text
|
5
|
||
9
|
Button6
|
Name
|
Button6
|
Text
|
6
|
||
10
|
Button7
|
Name
|
Button7
|
Text
|
7
|
||
11
|
Button8
|
Name
|
Button8
|
Text
|
8
|
||
12
|
Button9
|
Name
|
Button9
|
Text
|
9
|
||
13
|
Button10
|
Name
|
Button10
|
Text
|
0
|
||
14
|
Button11
|
Name
|
Button11
|
Text
|
.
|
||
15
|
Button12
|
Name
|
Button12
|
Text
|
Sin
|
||
16
|
Button13
|
Name
|
Button13
|
Text
|
Cos
|
||
17
|
Button14
|
Name
|
Button14
|
Text
|
Tan
|
||
18
|
Button15
|
Name
|
Button15
|
Text
|
Log
|
||
19
|
Button16
|
Name
|
Button16
|
Text
|
X
|
||
20
|
Button17
|
Name
|
Button17
|
Text
|
/
|
||
21
|
Button18
|
Name
|
Button18
|
Text
|
+
|
||
22
|
Button19
|
Name
|
Button19
|
Text
|
-
|
||
23
|
Button20
|
Name
|
Button20
|
Text
|
N!
|
||
24
|
Button21
|
Name
|
Button21
|
Item
|
^
|
||
25
|
Button22
|
Name
|
Button22
|
Text
|
|
||
26
|
Button23
|
Name
|
Button23
|
Text
|
Mod
|
||
27
|
Button24
|
Name
|
Button24
|
Text
|
Backspace
|
||
28
|
Button 25
|
Name
|
Button25
|
|
|
Text
|
C
|
29
|
Button 26
|
Name
|
Button 26
|
|
|
Text
|
Off
|
30
|
Button 27
|
Name
|
Button 27
|
|
|
Text
|
On
|
31
|
Button 28
|
Name
|
Button 28
|
|
|
Text
|
=
|
31
|
Button 29
|
Name
|
Button 29
|
|
|
Text
|
Exit
|
Lalu masukkan listing berikut ini:
Public Class form1
Dim Angka,
Hasil As Double
Dim proses As String
Dim a, b As Integer
Dim
tombolON As Boolean
Const pi As Double =
3.14159265358979
Untuk
mendeklarasikan variabel-variabel
seperti tipe data di atas. Variabel angka dan hasil dalam tipe data double.
Variabel
proses dalam tipe data string. Variabel a,b dalam tipe data integer.
Private Sub form1_Load(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
MyBase.Load
tombolON = False
Me.ForeColor
= Color.GhostWhite
Button29.ForeColor = Color.Black
Button30.ForeColor = Color.Black
End Sub
Untuk
menonaktifkan tombol On. Dan memberi warna pada button 29 dan 30.
Private Sub Button7_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button7.Click
If
tombolON = False Then
Exit Sub
End If
If
TextBox1.Text = "0" Then
TextBox1.Text = "1"
TextBox2.Text = "1"
Else
TextBox1.Text = TextBox1.Text &
"1"
TextBox2.Text = TextBox2.Text &
"1"
End If
End Sub
Untuk
memasukkan angka 1.
Private Sub Button8_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button8.Click
If
tombolON = False Then
Exit Sub
End If
If
TextBox1.Text = "0" Then
TextBox1.Text = "2"
TextBox2.Text = "2"
Else
TextBox1.Text = TextBox1.Text &
"2"
TextBox2.Text = TextBox2.Text &
"2"
End If
End Sub
Untuk
memasukkan angka 2.
Private Sub Button9_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button9.Click
If
tombolON = False Then
Exit Sub
End If
If
TextBox1.Text = "0" Then
TextBox1.Text = "3"
TextBox2.Text = "3"
Else
TextBox1.Text = TextBox1.Text &
"3"
TextBox2.Text = TextBox2.Text &
"3"
End If
End Sub
Untuk
memasukkan angka 3.
Private Sub Button4_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button4.Click
If
tombolON = False Then
Exit Sub
End If
If
TextBox1.Text = "0" Then
TextBox1.Text = "4"
TextBox2.Text = "4"
Else
TextBox1.Text = TextBox1.Text &
"4"
TextBox2.Text = TextBox2.Text &
"4"
End If
End Sub
Untuk
memasukkan angka 4.
Private Sub Button5_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button5.Click
If
tombolON = False Then
Exit Sub
End If
If
TextBox1.Text = "0" Then
TextBox1.Text = "5"
TextBox2.Text = "5"
Else
TextBox1.Text = TextBox1.Text &
"5"
TextBox2.Text = TextBox2.Text & "5"
End If
End Sub
Untuk
memasukkan angka 5.
Private Sub Button6_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button6.Click
If
tombolON = False Then
Exit Sub
End If
If
TextBox1.Text = "0" Then
TextBox1.Text = "6"
TextBox2.Text = "6"
Else
TextBox1.Text = TextBox1.Text &
"6"
TextBox2.Text = TextBox2.Text &
"6"
End If
End Sub
Untuk
memasukkan angka 6.
Private Sub Button1_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button1.Click
If
tombolON = False Then
Exit Sub
End If
If
TextBox1.Text = "0" Then
TextBox1.Text = "7"
TextBox2.Text = "7"
Else
TextBox1.Text = TextBox1.Text &
"7"
TextBox2.Text = TextBox2.Text &
"7"
End If
End Sub
Untuk
memasukkan angka 7.
Private Sub Button2_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button2.Click
If
tombolON = False Then
Exit Sub
End If
If
TextBox1.Text = "0" Then
TextBox1.Text = "8"
TextBox2.Text = "8"
Else
TextBox1.Text = TextBox1.Text &
"8"
TextBox2.Text = TextBox2.Text &
"8"
End If
End Sub
Untuk
memasukkan angka 8.
Private Sub Button3_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button3.Click
If
tombolON = False Then
Exit Sub
End If
If
TextBox1.Text = "0" Then
TextBox1.Text = "9"
TextBox2.Text = "9"
Else
TextBox1.Text = TextBox1.Text &
"9"
TextBox2.Text = TextBox2.Text &
"9"
End If
End Sub
Untuk
memasukkan angka 9.
Private Sub Button10_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button10.Click
If
tombolON = False Then
Exit Sub
End If
TextBox1.Text = TextBox1.Text & "."
TextBox2.Text = TextBox2.Text & "."
End Sub
Private Sub Button11_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button11.Click
If
tombolON = False Then
Exit Sub
End If
If
TextBox1.Text = "0" Then
TextBox1.Text = "0"
TextBox2.Text = "0"
Else
TextBox1.Text = TextBox1.Text &
"0"
TextBox2.Text = TextBox2.Text &
"0"
End If
End Sub
Untuk
memasukkan angka 0.
Private Sub Button12_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button12.Click
TextBox2.Text = TextBox2.Text & "+"
If
proses <> "" Then
Select
Case proses
Case
"+"
Call
Tambah()
Case
"-"
Call
kurang()
Case
"x"
Call
kali()
Case
"/"
Call
bagi()
Case
"^"
Call
pangkat()
Case
"log"
Call
Log()
Case
"^1/2″"
Call
akar()
Case
"N!"
Call
faktorial()
Case
"Sin"
Call
Sin()
Case
"Cos"
Call
Cos()
Case
"Tan"
Call
Tan()
Case
"mod"
Call
m()
End
Select
Else
Call
Tambah()
End If
proses = "+"
TextBox1.Text = ""
End Sub
Private Sub Tambah()
If
Angka = "0" Then
Angka = Val(TextBox1.Text)
Else
Angka = Angka + Val(TextBox1.Text)
End If
proses = "+"
TextBox1.Text = ""
End Sub
Untuk
mengoperasikan aritmatika penjumlahan, bisa dalam pararel juga. Di sini banyak
kemungkinan setelah aritmatika penjumlahan, bisa disambung dengan aritmatika
lain. Maksudnya case call tambah ini dibuktikan dengan listing Private sub
tambah () ini.
Private Sub Button13_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button13.Click
TextBox2.Text = TextBox2.Text & "-"
If
proses <> "" Then
Select
Case proses
Case
"+"
Call
Tambah()
Case
"-"
Call
kurang()
Case
"x"
Call
kali()
Case
"/"
Call
bagi()
Case
"^"
Call
pangkat()
Case
"log"
Call
Log()
Case
"^0.5"
Call
akar()
Case
"N!"
Call
faktorial()
Case
"Sin"
Call
Sin()
Case
"Cos"
Call
Cos()
Case
"Tan"
Call
Tan()
Case
"mod"
Call
m()
End
Select
Else
Call
kurang()
End If
proses = "-"
TextBox1.Text = ""
End Sub
Private Sub kurang()
If
Angka = "0" Then
Angka = Val(TextBox1.Text)
Else
Angka = Angka - Val(TextBox1.Text)
End If
proses = "-"
TextBox1.Text = ""
End Sub
Untuk
mengoperasikan aritmatika pengurangan, bisa dalam pararel juga. Di sini banyak
kemungkinan setelah aritmatika penjumlahan, bisa disambung dengan aritmatika lain.
Maksudnya case call kurang disini ini dibuktikan dengan listing Private sub kurang
() ini.
Private Sub Button14_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button14.Click
TextBox2.Text = TextBox2.Text & "x"
If
proses <> "" Then
Select
Case proses
Case
"+"
Call
Tambah()
Case
"-"
Call
kurang()
Case
"x"
Call
kali()
Case
"/"
Call
bagi()
Case
"^"
Call
pangkat()
Case
"log"
Call
Log()
Case
"^0.5"
Call
akar()
Case
"N!"
Call
faktorial()
Case
"Sin"
Call
Sin()
Case
"Cos"
Call
Cos()
Case
"Tan"
Call
Tan()
Case
"mod"
Call
m()
End
Select
Else
Call
kali()
End If
proses = "x"
TextBox1.Text = ""
End Sub
Private Sub kali()
If
Angka = "0" Then
Angka = Val(TextBox1.Text)
Else
Angka = Angka * Val(TextBox1.Text)
End If
proses = "x"
TextBox1.Text = ""
End Sub
Untuk
mengoperasikan aritmatika perkalian, bisa dalam pararel juga. Di sini banyak
kemungkinan setelah aritmatika perkalian, bisa disambung dengan aritmatika
lain. Maksudnya case call tambah ini dibuktikan dengan listing Private sub kali
() ini.
Private Sub Button15_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button15.Click
TextBox2.Text = TextBox2.Text & "/"
If
proses <> "" Then
Select
Case proses
Case
"+"
Call
Tambah()
Case
"-"
Call
kurang()
Case
"x"
Call
kali()
Case
"/"
Call
bagi()
Case
"^"
Call
pangkat()
Case
"log"
Call
Log()
Case
"^0.5"
Call
akar()
Case
"N!"
Call
faktorial()
Case
"Sin"
Call
Sin()
Case
"Cos"
Call
Cos()
Case
"Tan"
Call
Tan()
Case
"mod"
Call
m()
End
Select
Else
Call
bagi()
End If
proses = "/"
TextBox1.Text = 0
End Sub
Private Sub bagi()
If
Angka = "0" Then
Angka = Val(TextBox1.Text)
Else
Angka = Angka / Val(TextBox1.Text)
End If
proses = "/"
TextBox1.Text = ""
End Sub
Untuk
mengoperasikan aritmatika pembagian, bisa dalam pararel juga. Di sini banyak
kemungkinan setelah aritmatika pembagian, bisa disambung dengan aritmatika
lain. Maksudnya case call bagi ini dibuktikan dengan listing Private sub bagi
() ini.
Private Sub Button25_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button25.Click
TextBox2.Text = TextBox2.Text & "mod"
If
proses <> "" Then
Select
Case proses
Case
"+"
Call
Tambah()
Case
"-"
Call
kurang()
Case
"x"
Call
kali()
Case
"/"
Call
bagi()
Case
"^"
Call
pangkat()
Case
"log"
Call
Log()
Case
"^0.5"
Call
akar()
Case
"N!"
Call
faktorial()
Case
"Sin"
Call
Sin()
Case
"Cos"
Call
Cos()
Case
"Tan"
Call
Tan()
Case
"mod"
Call
m()
End
Select
Else
Call
m()
End If
End Sub
Private Sub m()
Angka = Val(TextBox1.Text)
If
Angka = Val(TextBox1.Text) Then
Else
Angka = Angka Mod Val(TextBox1.Text)
End If
proses = "mod"
TextBox1.Text = ""
End Sub
Untuk
mengoperasikan aritmatika mod. Mod ini untuk mencari sisa hasil bagi. Di sini
banyak kemungkinan setelah aritmatika mod, bisa disambung dengan aritmatika
lain. Maksudnya case call mod ini dibuktikan dengan listing Private sub mod ()
ini.
Private Sub Button23_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button23.Click
TextBox2.Text = TextBox2.Text & "!"
If
proses <> "" Then
Select
Case proses
Case
"+"
Call
Tambah()
Case
"-"
Call
kurang()
Case
"x"
Call
kali()
Case
"/"
Call
bagi()
Case
"^"
Call
pangkat()
Case
"log"
Call
Log()
Case
"^0.5"
Call
akar()
Case
"N!"
Call
faktorial()
Case
"Sin"
Call
Sin()
Case
"Cos"
Call
Cos()
Case
"Tan"
Call
Tan()
Case
"mod"
Call
m()
End
Select
Else
Call
faktorial()
End If
proses = "N!"
End Sub
Private Sub faktorial()
a = 1
For i =
1 To Val(TextBox1.Text)
a = a * i
Next
End Sub
Untuk
mengoperasikan aritmatika faktorial . Maksudnya case call faktorial ini
dibuktikan dengan listing Private sub faktorial () ini.
Private Sub Button17_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button17.Click
TextBox2.Text = "Sin" & TextBox2.Text
If
proses <> "" Then
Select
Case proses
Case
"+"
Call
Tambah()
Case
"-"
Call
kurang()
Case
"x"
Call
kali()
Case
"/"
Call
bagi()
Case
"^"
Call
pangkat()
Case
"log"
Call
Log()
Case
"^0.5"
Call
akar()
Case
"N!"
Call
faktorial()
Case
"Sin"
Call
Sin()
Case
"Cos"
Call Cos()
Case
"Tan"
Call
Tan()
Case
"mod"
Call
m()
End
Select
Else
Call
Sin()
End If
proses = "Sin"
TextBox1.Text = ""
End Sub
Private Sub Sin()
Angka = Val(TextBox1.Text)
Angka = Math.Sin(Angka
* (pi / 180))
proses = "Sin"
TextBox1.Text = ""
End Sub
Untuk
mengoperasikan aritmatika trigonometri sin ini. Maksudnya case call sin ini dibuktikan dengan listing Private sub sin
() ini.
Private Sub Button19_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button19.Click
TextBox2.Text = "Cos" & TextBox2.Text
If
proses <> "" Then
Select
Case proses
Case
"+"
Call
Tambah()
Case
"-"
Call
kurang()
Case
"x"
Call
kali()
Case
"/"
Call
bagi()
Case
"^"
Call
pangkat()
Case
"log"
Call
Log()
Case
"^0.5"
Call
akar()
Case
"N!"
Call
faktorial()
Case
"Sin"
Call
Sin()
Case
"Cos"
Call
Cos()
Case
"Tan"
Call
Tan()
Case
"mod"
Call
m()
End
Select
Else
Call
Cos()
End If
proses = "Cos"
End Sub
Private Sub Cos()
Angka = Val(TextBox1.Text)
Angka = Math.Cos(Angka
* (pi / 180))
proses = "Cos"
TextBox1.Text = ""
End Sub
Untuk
mengoperasikan aritmatika trigonometri cos ini. Maksudnya case call sin ini dibuktikan dengan listing Private sub cos
() ini.
Private Sub Button18_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button18.Click
TextBox2.Text = TextBox2.Text & "Tan"
If
proses <> "" Then
Select
Case proses
Case
"+"
Call
Tambah()
Case
"-"
Call
kurang()
Case
"x"
Call
kali()
Case
"/"
Call
bagi()
Case
"^"
Call
pangkat()
Case
"log"
Call
Log()
Case
"^0.5"
Call
akar()
Case
"N!"
Call
faktorial()
Case
"Sin"
Call
Sin()
Case
"Cos"
Call
Cos()
Case
"Tan"
Call
Tan()
Case
"mod"
Call
m()
End
Select
Else
Call
Tan()
End If
proses = "Tan"
TextBox1.Text = ""
End Sub
Private Sub Tan()
Angka = Val(TextBox1.Text)
Angka = Math.Tan(Angka
* (pi / 180))
proses = "Tan"
TextBox1.Text = ""
End Sub
Untuk
mengoperasikan aritmatika trigonometri tan ini. Maksudnya case call sin ini dibuktikan dengan listing Private sub tan ()
ini
Private Sub Button21_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button21.Click
If
TextBox1.Text.Length > 0 Then
TextBox1.Text =
TextBox1.Text.Remove(TextBox1.Text.Length - 1, 1)
End If
If
TextBox2.Text.Length > 0 Then
TextBox2.Text =
TextBox2.Text.Remove(TextBox2.Text.Length - 1, 1)
End If
End Sub
Ini untuk menegatifkan angka yang telah
dimasukkan dalam textbox.
Private Sub Button26_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button26.Click
TextBox2.Text = ""
TextBox1.Text = ""
End Sub
Listing ini
untuk menghapus angka yang telah dimasukkan.
Private Sub Button20_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button20.Click
If
proses = "+" Then
Hasil = Angka + Val(TextBox1.Text)
TextBox1.Text = Hasil
ElseIf
proses = "-" Then
Hasil = Angka - Val(TextBox1.Text)
TextBox1.Text = Hasil
ElseIf
proses = "x" Then
Hasil = Angka * Val(TextBox1.Text)
TextBox1.Text = Hasil
ElseIf
proses = "/" Then
Hasil = Angka / Val(TextBox1.Text)
TextBox1.Text = Hasil
ElseIf
proses = "^" Then
Hasil = Angka ^ Val(TextBox1.Text)
TextBox1.Text = Hasil
ElseIf
proses = "√" Then
Hasil = Val(TextBox1.Text) ^ 0.5
TextBox1.Text = Hasil
ElseIf
proses = "Cos" Then
Hasil = Math.Cos(Val(TextBox1.Text)
* (pi / 180))
TextBox1.Text = Hasil
ElseIf
proses = "Sin" Then
Hasil = Math.Sin(Val(TextBox1.Text)
* (pi / 180))
TextBox1.Text = Hasil
ElseIf
proses = "Tan" Then
Hasil = Math.Tan(Val(TextBox1.Text)
* (pi / 180))
TextBox1.Text = Hasil
ElseIf
proses = "N!" Then
TextBox1.Text = Str(a)
ElseIf
proses = "log10" Then
Hasil = Math.Log10(Val(TextBox1.Text))
TextBox1.Text = Hasil
ElseIf
proses = "mod" Then
Hasil = Angka Mod Val(TextBox1.Text)
TextBox1.Text = Hasil
End If
proses = ""
Angka = 0
End Sub
Untuk sama dengan
Private Sub Button16_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button16.Click
TextBox2.Text = "√" & TextBox2.Text
If
proses <> "" Then
Select
Case proses
Case
"+"
Call
Tambah()
Case
"-"
Call
kurang()
Case
"x"
Call
kali()
Case
"/"
Call
bagi()
Case
"^"
Call
pangkat()
Case
"log"
Call
Log()
Case
"^0.5"
Call
akar()
Case
"N!"
Call
faktorial()
Case
"Sin"
Call
Sin()
Case
"Cos"
Call
Cos()
Case
"Tan"
Call
Tan()
End
Select
Else
Call
akar()
End If
proses = "√"
TextBox1.Text = ""
End Sub
Private Sub akar()
Angka = Val(TextBox1.Text)
Angka = Angka ^ 0.5
proses = "√"
TextBox1.Text = ""
End Sub
Untuk
mengakar suatu bilangan yang telah diinput. Maksudnya case call akar ini
dibuktikan dengan listing Private sub akar () ini.
Private Sub Button27_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button27.Click
TextBox2.Text = TextBox2.Text & "^"
If
proses <> "" Then
Select
Case proses
Case
"+"
Call
Tambah()
Case
"-"
Call
kurang()
Case
"x"
Call
kali()
Case
"/"
Call
bagi()
Case
"^"
Call
pangkat()
Case
"log"
Call
Log()
Case
"^0.5"
Call
akar()
Case
"N!"
Call
faktorial()
Case
"Sin"
Call
Sin()
Case
"Cos"
Call
Cos()
Case
"Tan"
Call
Tan()
End
Select
Else
Call
pangkat()
End If
proses = "^"
TextBox1.Text = ""
End Sub
Private Sub pangkat()
If
Angka = "0" Then
Angka = Val(TextBox1.Text)
Else
Angka = Angka ^ Val(TextBox1.Text)
End If
proses = "^"
TextBox1.Text = ""
End Sub
Untuk pangkat
suatu bilangan yang telah diinput. Maksudnya case call pangkat ini dibuktikan
dengan listing Private sub pangkat () ini.
Private Sub Button22_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button22.Click
TextBox2.Text = TextBox2.Text & "log"
If
proses <> "" Then
Select
Case proses
Case
"+"
Call
Tambah()
Case
"-"
Call
kurang()
Case
"x"
Call
kali()
Case
"/"
Call
bagi()
Case
"^"
Call
pangkat()
Case
"log"
Call
Log()
Case
"^0.5"
Call
akar()
Case
"N!"
Call
faktorial()
Case
"Sin"
Call
Sin()
Case
"Cos"
Call
Cos()
Case
"Tan"
Call
Tan()
End
Select
Else
Call
Log()
End If
proses = "log10"
End Sub
Private Sub Log()
Angka = Val(TextBox1.Text)
Angka = Math.Log10(Angka)
proses = "log10"
TextBox1.Text = ""
End Sub
Untuk menetukan
log suatu bilangan yang telah diinput. Maksudnya case log akar ini dibuktikan
dengan listing Private sub log () ini.
Private Sub Button30_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button30.Click
tombolON = True
Me.ForeColor
= Color.Black
End Sub
Private Sub Button29_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button29.Click
tombolON = False
Me.ForeColor
= Color.GhostWhite
Button29.ForeColor = Color.Black
End Sub
Private Sub Button28_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button28.Click
Close()
End Sub
Private Sub TextBox1_TextChanged(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
TextBox1.TextChanged
End Sub
End Class
Dan tampilah akan jadi
seperti ini.