Vous êtes sur la page 1sur 12

Belajar Visual Basic 2010 yukk..

:D
November 17, 2011

Tutorial Teknologi Informatika Visual Basic 2010 Membuat Program Jual Beli Sederhana Kelompok 23 dalam hal ini membuat kasir dalam Istana Coffee an! men"ual beberapa menu, an! har!a dan formula lainn a dapat lan!sun! diproses pada pro!ram kasir sederhana ini# $an!kah % lan!kah pembuatan pro!ramn a & 1# 'embuka (plikasi )isual *asi+ 2010

1# Klik ok maka akan mu+ul tampilan seperti berikut 2#'enampilkan ,oolbo- an! akan di!unakan 'emasukkan toolbo-.toolbo- an! di!unakan'emasukkan toolbo-.toolbo- an! akan di!unakan dalam pro!ram ini# /ntuk memun+ulkan toolbo-, bisa dimun+ulkan dari menu bar 0 vie1 0 other 1indo1s 0 tollbo-

3#/bah nama pada tombol.tombol seperti an! kita in!inkan

Komponen toolbo- an!di!unakan&


Komponen Form1 Properties Name Keterangan

,e-t2orm1 Combo*o-$abel1Name ,e-t$abel1 3emba aran$abel2Name ,e-t$abel2 Kembalian$abel3Name ,e-t$abel3 4umlah$abel5Name ,e-t$abel5 3oton!an$abel6Name ,e-t$abel6 4udul 3ro!ram$abel7Name ,e-t$abel7 8ar!a$abel7Name ,e-t$abel7 4enis *aran!3i+ture*o-1Ima!eIma!e Coffee $atte3i+ture*o-2Ima!eIma!e 9spresso3i+ture*o-3Ima!eIma!e Capu++ino3i+ture*o-5Ima!eIma!e Irish Coffee3i+ture*o-6Ima!eIma!e $uak Coffee3i+ture*o-7Ima!eIma!e 'o++a+ino*utton1Name ,e-t*utton1

3embelian*utton2Name ,e-t*utton2 Keluar*utton3Name ,e-t*utton3 Clear*utton5Name ,e-t*utton5 KembalianCombo*o-1NameCombo*o-1Combo*o-2NameCom bo*o-2:adiobutton1Name ,e-t:adiobutton1 0:adiobutton2Name ,e-t:adiobutton1 6:adiobutton3Name ,e-t:adiobutton1 5#/ntuk men!!anti ba+k!round form1 pilih properties Backgroundimage- local resource-import-ok

5. 'en!!anti st le pada toolbo- ;font,ba+k!round toolbo-<, klik toolbox ang hendak diganti st len a!pilih properties"ont#huru"$-$-backcolor#background toolbox$"orecolor#%arna tulisan toolbox$.

7#/ntuk menampilkan !ambar % !ambar dari "enis +offee dapat men!!unakanpicturebox pada toolbo-# Pilih picturebox-image-local resource-ok

Keteran!an& 3ada kotak pi+turebo-, pilih &alse pada subkotak 'isible

=etelah bentuk form1 selesai, kemudian 1#>eklarasikan variabel 8ar!a?Kotor, 8ar!a?*ersih, dan poton!an se+ara !enerla sekali!us pada event form1?load# $alu ketikkan listin! pro!ram berikut & >im 8ar!a?Kotor, 8ar!a?*ersih (s Inte!er >im poton!an (s Inte!er @ 0 3rivate =ub 2orm1?$oad;* )al sender (s = stem#Ab"e+t, * )al e (s = stem#9vent(r!s< 8andles ' *ase#$oad Bith Combo*o-1 #Items#(dd;Coffee $atte< #Items#(dd;9spresso< #Items#(dd;Cappu++ino< #Items#(dd;Irish Coffee< #Items#(dd;$uak Coffee< #Items#(dd;'o++a+ino< 9nd Bith 9nd =ub 2#/ntuk menampilkan 8ar!a dan Cambar "enis Coffee klik Combo*o-1, dan ketikkan listin! berikut & 3rivate =ub Combo*o-1?=ele+tedInde-Chan!ed;* )al sender (s = stem#Ab"e+t, * )al e (s = stem#9vent(r!s< 8andles Combo*o-1#=ele+tedInde-Chan!ed

If Combo*o-1#,e-t @ ;Coffee $atte< ,hen ,e-t*o-3#,e-t @ ;16000D< If Combo*o-1#,e-t @ ;Coffee $atte< ,hen 3i+ture*o-1#=ho1;< If Combo*o-1#,e-t @ ;9spresso< ,hen ,e-t*o-3#,e-t @ ;10000D< If Combo*o-1#,e-t @ ;9spresso< ,hen 3i+ture*o-2#=ho1;< If Combo*o-1#,e-t @ ;Cappu++ino< ,hen ,e-t*o-3#,e-t @ ;12000D< If Combo*o-1#,e-t @ ;Cappu++ino< ,hen 3i+ture*o-3#=ho1;< If Combo*o-1#,e-t @ ;Irish Coffee< ,hen ,e-t*o-3#,e-t @ ;17000D< If Combo*o-1#,e-t @ ;Irish Coffee< ,hen 3i+ture*o-5#=ho1;< If Combo*o-1#,e-t @ ;$uak Coffee< ,hen ,e-t*o-3#,e-t @ ;16000D< If Combo*o-1#,e-t @ ;$uak Coffee< ,hen 3i+ture*o-6#=ho1;< If Combo*o-1#,e-t @ ;'o++a+ino< ,hen ,e-t*o-3#,e-t @ ;E000D< If Combo*o-1#,e-t @ ;'o++a+ino< ,hen 3i+ture*o-7#=ho1;< 9nd =ub 3#*uat event Che+ked+han!ed untuk keti!a :adiobutton den!an klik "umlah poton!an kemudian ketikkan listin! berikut & 3rivate =ub :adio*utton1?Che+kedChan!ed;* )al sender (s = stem#Ab"e+t, * )al e (s = stem#9vent(r!s< 8andles :adio*utton1#Che+kedChan!ed, :adio*utton2#Che+kedChan!ed, :adio*utton3#Che+kedChan!ed poton!an @ sender#te-t

9nd =ub 5#*uat 9vent *utton1?+li+k den!an klik *utton1 ;3embelian< kemudian masukkan listin! berikut & 3rivate =ub *utton1?Cli+k;* )al sender (s = stem#Ab"e+t, * )al e (s = stem#9vent(r!s< 8andles *utton1#Cli+k >im diskon (s =in!le >im total (s =in!le If ,e-t*o-1#,e-t @ )al;,e-t*o-1#,e-t< (nd ,e-t*o-1#,e-t FG 0 ,hen diskon @ ;,e-t*o-3#,e-t H ,e-t*o-1#,e-t H poton!an< I 100 total @ ;,e-t*o-3#,e-t H ,e-t*o-1#,e-t % diskon< ,e-t*o-2#,e-t @ 2ormat;total, J,J< 9lse & ,e-t*o-2#,e-t @ error 9nd If 9nd =ub 1# /ntuk event *utton5?+li+k den!an klik *utton5 ;Kembalian< kemudian ketikkan listin! berikut& 3rivate =ub *utton5?Cli+k;* )al sender (s = stem#Ab"e+t, * )al e (s = stem#9vent(r!s< 8andles *utton5#Cli+k $abel2#,e-t @ ,e-t*o-5#,e-t % ,e-t*o-2#,e-t If ,e-t*o-5#,e-t F@ ,e-t*o-2#,e-t ,hen 'essa!e*o-#=ho1;,e-t*o-5, '((2 /(NC (N>( ,I>(K '9NC/K/3I< 9lseIf ,e-t*o-5#,e-t G ,e-t*o-2#,e-t ,hen 'essa!e*o-#=ho1;,e-t*o-5, ,9:I'(K(=I8 (,(= K/N4/NC(N (N>( K9 C(29 K('I <

9nd If 9nd =ub 6#/ntuk event *utton3?+li+k den!an klik *utton3 ;Clear< kemudian ketikkan listin! berikut & 3rivate =ub *utton3?Cli+k;* )al sender (s = stem#Ab"e+t, * )al e (s = stem#9vent(r!s< 8andles *utton3#Cli+k Combo*o-1#,e-t @ =trin!#9mpt ,e-t*o-1#,e-t @ ,e-t*o-2#,e-t @ ,e-t*o-3#,e-t @ ,e-t*o-5#,e-t @ 3i+ture*o-1#)isible @ 2alse 3i+ture*o-2#)isible @ 2alse 3i+ture*o-3#)isible @ 2alse 3i+ture*o-5#)isible @ 2alse 3i+ture*o-6#)isible @ 2alse 3i+ture*o-7#)isible @ 2alse :adio*utton1#Che+ked @ Nothin! :adio*utton2#Che+ked @ Nothin! :adio*utton3#Che+ked @ Nothin! $abel2#,e-t @ Nothin! 9nd =ub 7#>an an! terakhir, buat event *utton2?+li+k den!an klik *utton2 ;Keluar< kemudian listin! berikut&

3rivate =ub *utton2?Cli+k;* )al sender (s = stem#Ab"e+t, * )al e (s = stem#9vent(r!s< 8andles *utton2#Cli+k Close;< 9nd =ub 7#/ntuk memulai pro!ram ketik !,atau start "ebugging pada menubar# *erikut adalah tampilan akhir dari aplikasi pro!ram hitun! sederhana an! telah dibuat &

2$ABC8(:, 3:AC:(' "ual?*eli

(bout these ads

Vous aimerez peut-être aussi