Selasa, 27 September 2011

tugas visual besic



TUGAS VISUAL BESIC
NPM  :43a87067100004
Nama       :anggie meylanda dea



Langkah – langkah membuat program kalkulator
1.Buka program visual besic klik file >> new projec
            ‘’Seperti tampilan dibawah ini









2.kemudian akan tampil tampilan seperti dibawah ini











3. Kemudian buatlah objec texbox dan 16 buah comment button









4.Agar terlihat rapi setting textox dan commant button ,seperti gambar di bawah ini sesuai dengan textbox dan comment button








5. kemudian double klik pada form dan akan muncul tampilan seperti di bawah..
ketiklah sesuai tulisan dibawah
DIM St, st2 As string

Private Sub command1_click ()
If st = “T” then
Text1.text = 1
Else
If st2 = “T” then
Text2.text  = 1
End if
End if
End sub

Private sub command 10_click ()
If st = “T” then
Text1.text =0
Else
If st2 = “T” then
Text2.text = 0
End if
End if
End sub

Private sub command11_click ()
Label1.caption = “+”
End sub

Private sub command12_click ()
Label1.caption = “-”
End sub

Private sub command13_click ()
Label1.caption = “*”
End sub

Private sub command14_click ()
Label1.caption = “/”
End sub

private sub command15-click ()
if label1.caption = “+” then
text3.text = val (text1.text) + (text2.text)
else
if label1.caption = “-” then
text3.text = val (text1.text) -(text2.text)
else
if label1.caption = “*” then
text3.text = val (text1.text) * (text2.text)
else

text3.text = val (text1.text) / (text2.text)
end if
end if
end sub

private sub command2_click()
if st = “T” then
text1.text =2
else
if st2 = “T” then
text2.text = 2
end if
end if
end sub

 private sub command3_click()
if st = “T” then
text1.text =3
else
if st2 = “T” then
text2.text = 3
end if
end if
end sub

private sub command4_click()
if st = “T” then
text1.text =4
else
if st2 = “T” then
text2.text = 4
end if
end if
end sub

private sub command5_click()
if st = “T” then
text1.text =5
else
if st2 = “T” then
text2.text = 5
end if
end if
end sub

private sub command6_click()
if st = “T” then
text1.text =6
else
if st2 = “T” then
text2.text = 6
end if
end if
end sub

private sub command7_click()
if st = “T” then
text1.text =7
else
if st2 = “T” then
text2.text = 7
end if
end if
end sub

private sub command8_click()
if st = “T” then
text1.text =8
else
if st2 = “T” then
text2.text = 8
end if
end if
end sub


private sub command9_click()
if st = “T” then
text1.text =9
else
if st2 = “T” then
text2.text = 9
end if
end if
end sub




private sub label1_click()

end sub


private sub text1_click()
st = “T”
st2 = “F”
end sub

private sub text2_click()
st = “F”
st2 =”T”
end sub

private sub text3_change()

End sub




6.setelah itu buka tampilan kalkulator yang telah di buat dan run program satu persatu tetapi terlebih dahulu hapus tulisan text 1 yang ada d textbox dan ganti dengan angka sesuai angka yang anda inginkan..
dan kalkulator siap beroperasi seperti contoh dibawah ini









7.ganti tulisan text1 dengan angka 9 dan text2 dengan angka 2 kemudian klik (-)  lalu klik tanda (=) maka akan muncul hasilnya seperti gambar dibawah ini





























































































































































































































































































































































































































































Tidak ada komentar:

Posting Komentar