MEMBUAT APLIKASI SEDERHANA PERHOTELAN MELALUI VB 2010.NET
Posting kali ini saya akan menampilkan hasil Program sederhana yang saya buat setelah mendapatkan tugas untuk membuat sebuah program sederhana menggunakan Visual Basic 2010Net dari Dosen. Untuk Listing programnya ada di bawah ini :
Public Class Tugas1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub txtlama_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtlama.TextChanged
Dim lama As Integer
Try
lama = Integer.Parse(txtlama.Text)
Catch ex As Exception
End Try
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Dim harga As Double
Dim lama As Integer
If ComboBox1.Text = "President" Then
txthargakamar.Text = "5500000"
Try
harga = Double.Parse(txthargakamar.Text)
Catch ex As Exception
End Try
Try
lama = Integer.Parse(txtlama.Text)
Catch ex As Exception
End Try
ElseIf ComboBox1.Text = "Eksekutif" Then
txthargakamar.Text = "4000000"
Try
harga = Double.Parse(txthargakamar.Text)
Catch ex As Exception
End Try
Try
lama = Integer.Parse(txtlama.Text)
Catch ex As Exception
End Try
ElseIf ComboBox1.Text = "Suit" Then
txthargakamar.Text = "2000000"
Try
harga = Double.Parse(txthargakamar.Text)
Catch ex As Exception
End Try
Try
lama = Integer.Parse(txtlama.Text)
Catch ex As Exception
End Try
End If
txtttlhargakmr.Text = harga * lama
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tampilkan.Click
MsgBox("Nama = " & txtnama.Text & vbNewLine &
"Lama Menginap = " & txtlama.Text & vbNewLine &
"Tipe Kamar = " & ComboBox1.Text & vbNewLine &
"Harga kamar = " & txthargakamar.Text & vbNewLine &
"Total harga paket = " & txtttlhrgpaket.Text & vbNewLine &
"Total harga Keseluruhan = " & txttotalharga.Text & vbNewLine)
End Sub
Private Sub txtttlhrgpaket_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtttlhrgpaket.TextChanged
End Sub
Private Sub Radio1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Radio1.CheckedChanged
txthrgpaket.Text = "500000"
End Sub
Private Sub Radio2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Radio2.CheckedChanged
txthrgpaket.Text = "250000"
End Sub
Private Sub Radio3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Radio3.CheckedChanged
txthrgpaket.Text = "100000"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Proses.Click
Dim totalhargakamar As Double
Dim totalhargapaket As Double
Try
totalhargakamar = Double.Parse(txtttlhargakmr.Text)
Catch ex As Exception
End Try
Try
totalhargapaket = Double.Parse(txtttlhrgpaket.Text)
Catch ex As Exception
End Try
txttotalharga.Text = totalhargakamar + totalhargapaket
End Sub
Private Sub Jmlpaket_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Jmlpaket.TextChanged
Dim hargapaket As Integer
Dim jumlah As Integer
Try
hargapaket = Integer.Parse(txthrgpaket.Text)
Catch ex As Exception
End Try
Try
jumlah = Integer.Parse(Jmlpaket.Text)
Catch ex As Exception
End Try
txtttlhrgpaket.Text = hargapaket * jumlah
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bersihkan.Click
txtnama.Text = ""
txthargakamar.Text = ""
txtttlhargakmr.Text = ""
txtttlhrgpaket.Text = ""
txthrgpaket.Text = ""
txttotalharga.Text = ""
txtlama.Text = ""
Jmlpaket.Text = ""
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Keluar.Click
If MsgBox("Anda yakin akan keluar?", vbYesNo + vbQuestion + vbDefaultButton2, "Keluar") = vbYes Then Me.Close()
End Sub
End Class
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub txtlama_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtlama.TextChanged
Dim lama As Integer
Try
lama = Integer.Parse(txtlama.Text)
Catch ex As Exception
End Try
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Dim harga As Double
Dim lama As Integer
If ComboBox1.Text = "President" Then
txthargakamar.Text = "5500000"
Try
harga = Double.Parse(txthargakamar.Text)
Catch ex As Exception
End Try
Try
lama = Integer.Parse(txtlama.Text)
Catch ex As Exception
End Try
ElseIf ComboBox1.Text = "Eksekutif" Then
txthargakamar.Text = "4000000"
Try
harga = Double.Parse(txthargakamar.Text)
Catch ex As Exception
End Try
Try
lama = Integer.Parse(txtlama.Text)
Catch ex As Exception
End Try
ElseIf ComboBox1.Text = "Suit" Then
txthargakamar.Text = "2000000"
Try
harga = Double.Parse(txthargakamar.Text)
Catch ex As Exception
End Try
Try
lama = Integer.Parse(txtlama.Text)
Catch ex As Exception
End Try
End If
txtttlhargakmr.Text = harga * lama
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tampilkan.Click
MsgBox("Nama = " & txtnama.Text & vbNewLine &
"Lama Menginap = " & txtlama.Text & vbNewLine &
"Tipe Kamar = " & ComboBox1.Text & vbNewLine &
"Harga kamar = " & txthargakamar.Text & vbNewLine &
"Total harga paket = " & txtttlhrgpaket.Text & vbNewLine &
"Total harga Keseluruhan = " & txttotalharga.Text & vbNewLine)
End Sub
Private Sub txtttlhrgpaket_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtttlhrgpaket.TextChanged
End Sub
Private Sub Radio1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Radio1.CheckedChanged
txthrgpaket.Text = "500000"
End Sub
Private Sub Radio2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Radio2.CheckedChanged
txthrgpaket.Text = "250000"
End Sub
Private Sub Radio3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Radio3.CheckedChanged
txthrgpaket.Text = "100000"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Proses.Click
Dim totalhargakamar As Double
Dim totalhargapaket As Double
Try
totalhargakamar = Double.Parse(txtttlhargakmr.Text)
Catch ex As Exception
End Try
Try
totalhargapaket = Double.Parse(txtttlhrgpaket.Text)
Catch ex As Exception
End Try
txttotalharga.Text = totalhargakamar + totalhargapaket
End Sub
Private Sub Jmlpaket_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Jmlpaket.TextChanged
Dim hargapaket As Integer
Dim jumlah As Integer
Try
hargapaket = Integer.Parse(txthrgpaket.Text)
Catch ex As Exception
End Try
Try
jumlah = Integer.Parse(Jmlpaket.Text)
Catch ex As Exception
End Try
txtttlhrgpaket.Text = hargapaket * jumlah
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bersihkan.Click
txtnama.Text = ""
txthargakamar.Text = ""
txtttlhargakmr.Text = ""
txtttlhrgpaket.Text = ""
txthrgpaket.Text = ""
txttotalharga.Text = ""
txtlama.Text = ""
Jmlpaket.Text = ""
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Keluar.Click
If MsgBox("Anda yakin akan keluar?", vbYesNo + vbQuestion + vbDefaultButton2, "Keluar") = vbYes Then Me.Close()
End Sub
End Class
Nah,,, Demikian Saudara-saudara, Program yang telah saya buat semoga dapat membantu anda memahami lebih dalam fungsi-fungsi dan logic yang ada dalam Vb 2010, atau mungkin Program yang saya buat dapat sedikit membantu anda.
Jika Anda ingin mencoba Program yang saya buat, silahkan Download di http://www.4shared.com/get/37Sp-P28/Imam_Cunda_Bagus_T_11112384.html jangan lupa extract dulu filenya dan dunakan VB 2010.net untuk membukanya,
Sekian terimakasih
Tidak ada komentar:
Posting Komentar