Tutorial pembuatan calculator22

18
Tutorial pembuatan calculator menggunakan Microsoft visual basic 2010 express edition Nama : M. Ario Bagus P. Kelas : X RPL 1 Sekolah : SMKN 1 DEPOK

description

 

Transcript of Tutorial pembuatan calculator22

Page 1: Tutorial pembuatan calculator22

Tutorial pembuatan calculator menggunakan Microsoft visual basic 2010 express edition

Nama : M. Ario Bagus P.

Kelas : X RPL 1

Sekolah : SMKN 1 DEPOK

Page 2: Tutorial pembuatan calculator22
Page 3: Tutorial pembuatan calculator22

1. Download aplikasi visual basic 2010 express edition nya di: http://www.microsoft.com/visualstudio/en-gb/express

Page 4: Tutorial pembuatan calculator22

2. Setelah aplikasi nya di download, install aplikasi nya, maka dia akan otomatis mendownload visual basic 2010 express edition yang kita inginkan.

Page 5: Tutorial pembuatan calculator22

3. Setelah proses download selesai, lalu bukalah aplikasi nya

Page 6: Tutorial pembuatan calculator22

4. Setelah aplikasi di buka, lalu klik file new project windows form application. Dan pada kolom nama beri nama CALCULATOR

Page 7: Tutorial pembuatan calculator22

5. Pada toolbox all windows form, tambahkan 19 button dan 1 text box kedalam FORM anda, dan susun lah seperti pada nomor 6

Page 8: Tutorial pembuatan calculator22

6. Inilah hasil setelah di susun

7. Lalu editlah pada properties Form1 sesuai table di bawah ini

FormBorderStyle Fixed 3DIcon (*bebas tapi harus .ico)MaximizeBox FalseStart Position Center ScreenText Calculator

- Klik 2 kali form nya, lalu di bawah public class form1 masukan kode di bawah ini

Dim Operand1 As Double Dim Operand2 As Double Dim [Operator] As String

8. Lalu editlah pada properties Button1 sesuai tabel di bawah ini

Locked True

Page 9: Tutorial pembuatan calculator22

Text 1

- Double click Button 1 dan masukan kode di bawah ini

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click, Button2.Click, Button3.Click, Button4.Click, Button5.Click, Button6.Click, Button7.Click, Button8.Click, Button9.Click, Button11.Click

TextBox1.Text = TextBox1.Text & sender.text

End Sub

9. Lalu editlah properties button button berikut- Properties pada button 2

Locked TrueText 2

- Properties pada button 3

Locked TrueText 3

- Properties pada button 4

Locked TrueText 4

- Properties pada button 5

Locked TrueText 5

- Properties pada button 6

Locked TrueText 6

Page 10: Tutorial pembuatan calculator22

- Properties pada button 7

Locked TrueText 7

- Properties pada button 8

Locked TrueText 8

- Properties pada button 9

Locked TrueText 9

- Properties pada button 10

Locked TrueText .

10. Double click Button . , dan masukan code di bawah ini

Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click

If InStr(TextBox1.Text, ".") > 0 Then Exit Sub Else TextBox1.Text = TextBox1.Text & "." End If

End Sub

- Properties pada button 11

Locked TrueText 0

- Properties pada button 12

Page 11: Tutorial pembuatan calculator22

ForeColor (bebas, sesuka anda)Locked TrueText C

11. Double click button C dan masukan code di bawah ini

Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click

TextBox1.Text = ""

End Sub

12. Properties pada button 13

ForeColor (bebas, sesuka anda)Locked TrueText +

Double click button + , dan masukan kode di bawah ini

Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click

Operand1 = Val(TextBox1.Text) TextBox1.Text = "" TextBox1.Focus() [Operator] = "+"

End Sub

13. Properties pada button 14

ForeColor (bebas, sesuka anda)Locked TrueText -

Double click button - , dan masukan code di bawah ini

Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click

Operand1 = Val(TextBox1.Text)

Page 12: Tutorial pembuatan calculator22

TextBox1.Text = "" TextBox1.Focus() [Operator] = "-"

End Sub

14. Properties pada button 15

ForeColor (bebas, sesuka anda)Locked TrueText *

Double click button * , dan masukan kode di bawah ini

Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click

Operand1 = Val(TextBox1.Text) TextBox1.Text = "" TextBox1.Focus() [Operator] = "*"

End Sub

15. Pada properties button 16

ForeColor (bebas, sesuka anda)Locked TrueText /

- Double click button / , dan masukan code dibawah ini

Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click

Operand1 = Val(TextBox1.Text) TextBox1.Text = "" TextBox1.Focus() [Operator] = "/"

End Sub

Page 13: Tutorial pembuatan calculator22

16. Pada properties button 17

Locked TrueText 1/x

- Double click button 1/x , dan masukan code di bawah ini

Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button17.Click Dim convert As Single If TextBox1.Text <> 0 Then convert = 1 / Val(TextBox1.Text) TextBox1.Text = convert End If

End Sub

17. Pada properties button 18

Locked TrueText +-

- Double click button +- , dan masukan code di bawah ini

Private Sub Button18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button18.Click

TextBox1.Text = -1 * TextBox1.Text

End Sub

18. Properties pada button 19

Locked TrueText =

- Double click button = , dan masukan code di bawah ini:

Private Sub Button19_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button19.Click

Dim Result As Double Operand2 = Val(TextBox1.Text)

'If [Operator] = "+" Then ' Result = Operand1 + Operand2 'ElseIf [Operator] = "-" Then

Page 14: Tutorial pembuatan calculator22

' Result = Operand1 - Operand2 'ElseIf [Operator] = "/" Then ' Result = Operand1 / Operand2 'ElseIf [Operator] = "*" Then ' Result = Operand1 * Operand2 'End If

Select Case [Operator] Case "+" Result = Operand1 + Operand2 MsgBox(Result.ToString("#,###.00"), MsgBoxStyle.Information, "Result") TextBox1.Text = Result.ToString("#,###.00") Case "-" Result = Operand1 - Operand2 MsgBox(Result.ToString("#,###.00"), MsgBoxStyle.Information, "Result") TextBox1.Text = Result.ToString("#,###.00") Case "/" Result = Operand1 / Operand2 MsgBox(Result.ToString("#,###.00"), MsgBoxStyle.Information, "Result") TextBox1.Text = Result.ToString("#,###.00") Case "*" Result = Operand1 * Operand2 MsgBox(Result.ToString("#,###.00"), MsgBoxStyle.Information, "Result") TextBox1.Text = Result.ToString("#,###.00") End Select TextBox1.Text = Result.ToString("#,###.00")

End SubEnd Class

Page 15: Tutorial pembuatan calculator22

19. Sebelum melakukan komplikasi program, double click my project pada colom solution explorer, pilih Assembly

Information dan kalian bias mengisi penjelasan atas software yang kaliat buat ini, dan pilih icon sesuka kalian (*.ico)

Page 16: Tutorial pembuatan calculator22

20. Dan ini lah hasil ketika gambar sudah di RUN, dan tidak terjadi DEBUG atau eror