Kamis, 15 Desember 2016
Program Pembuka Access
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.OleDb
Public Class Form1
Dim xReader As OleDbDataReader
Dim Koneksi As String = "Provider=Microsoft.ACE.OLEDB.16.0;Data Source =C:\Users\Farah\Documents\DatabaseVelyPerpus.mdb"
Dim Objek As New OleDb.OleDbConnection(Koneksi)
Private Sub BtnAdd_Click(sender As Object, e As EventArgs) Handles BtnAdd.Click
If BtnAdd.Text = "Add" Then
TxtKode.Text = ""
TxtNamaBuku.Text = ""
TxtJumlah.Text = ""
TxtNamaPeminjam.Text = ""
TxtTglPinjam.Text = ""
TxtTglPengembalian.Text = ""
TxtTglPengembalian.Focus()
BtnAdd.Text = "Save"
Else
Objek.Open()
Dim Add As String = "INSERT INTO Data Peminjaman values ('" & TxtKode.Text & "', '" & TxtNamaBuku.Text & "', '" & TxtJumlah.Text & "', '" & TxtNamaPeminjam.Text & "', '" & TxtTglPinjam.Text & "', '" & TxtTglPengembalian.Text & "')"
Dim oCMD = New OleDbCommand(Add, Objek)
oCMD.ExecuteNonQuery()
Objek.Close()
MsgBox("Sukses")
BtnAdd.Text = "Add"
End If
End Sub
Private Sub BtnFind_Click(sender As Object, e As EventArgs) Handles BtnFind.Click
Dim Kode As String = InputBox("Masukkan Nama")
If Not Len(Kode) = 0 Then
Objek.Close()
Objek.Open()
Dim Cari As String = "SELECT * FROM Data Koleksi Buku where nama = '" + Kode + "'"
Dim oCMD = New OleDbCommand(Cari, Objek)
xReader = oCMD.ExecuteReader
If xReader.HasRows Then
xReader.Read()
TxtKode.Text = xReader("Kode")
TxtNamaBuku.Text = xReader("Nama Buku")
TxtJumlah.Text = xReader("Jumlah")
TxtNamaPeminjam.Text = xReader("Nama Peminjam")
TxtTglPinjam.Text = xReader("Tanggal Peminjaman")
TxtTglPengembalian.Text = xReader("Tanggal Pengembalian")
Else
MsgBox("Data Koleksi Buku" + Kode + "tidak ada")
TxtKode.Text = ""
TxtNamaBuku.Text = ""
TxtJumlah.Text = ""
TxtNamaPeminjam.Text = ""
TxtTglPinjam.Text = ""
TxtTglPengembalian.Focus()
End If
End If
End Sub
Private Sub BtnEdit_Click(sender As Object, e As EventArgs) Handles BtnEdit.Click
Objek.Close()
Objek.Open()
Dim Ubah As String = "UPDATE Data Peminjaman set tipe = '" & TxtKode.Text & "', Kode Buku = '" & TxtNamaBuku.Text & "', Nama Buku = '" & TxtJumlah.Text & "', Jumlah Buku = '" & TxtNamaPeminjam.Text & "' , Nama Peminjam = '" & TxtTglPinjam.Text & "', where Tanggal Peminjaman = '" & TxtTglPengembalian.Text & "'"
Dim oCMD = New OleDbCommand(Ubah, Objek)
oCMD.ExecuteNonQuery()
Objek.Close()
MsgBox("Sukses")
End Sub
Private Sub btnView_Click(sender As Object, e As EventArgs) Handles BtnView.Click
FormKoleksiData.Show()
End Sub
Private Sub BtnPrint_Click(sender As Object, e As EventArgs) Handles BtnPrint.Click
Form2.Show()
End Sub
Private Sub BtnClose_Click(sender As Object, e As EventArgs) Handles BtnClose.Click
Me.Close()
End Sub
Private Sub BtnDelete_Click(sender As Object, e As EventArgs) Handles BtnDelete.Click
Objek.Close()
Objek.Open()
Dim Hapus As String = "DELETE FROM Data Peminjaman where tipe = '" & TxtKode.Text & "'"
Dim oCMD = New OleDbCommand(Hapus, Objek)
oCMD.ExecuteNonQuery()
TxtKode.Text = ""
TxtNamaBuku.Text = ""
TxtJumlah.Text = ""
TxtNamaPeminjam.Text = ""
TxtTglPinjam.Text = ""
TxtTglPengembalian.Focus()
MsgBox("Data berhasil dihapus")
End Sub
End Class
Minggu, 16 Oktober 2016
Membuat data transaksi laundry dengan VB (UTS)
Halo..
Saya akan memberitahu bagaimana membuat aplikasi untuk data transaksi dari sebuah perusahaan jasa laundry dengan menggunakan Visual Basic
Buat Design sesuai apa yang anda inginkan terlebih dahulu, misalnya seperti ini
Saya akan memberitahu bagaimana membuat aplikasi untuk data transaksi dari sebuah perusahaan jasa laundry dengan menggunakan Visual Basic
Buat Design sesuai apa yang anda inginkan terlebih dahulu, misalnya seperti ini
Lalu buatlah data transaksis yang sama dalam word untuk menyimpan data, bisa dijadikan sebagai bukti nota misalnya seperti ini
Dalam Word jangan lupa untuk melakukan bookmark di setiap data yang akan di masukkan.
Untuk menyimpan data transaksi bagi data perusahaan pribadi anda sendiri, buatlah tabel data dalam excel seperti ini
Setelah itu simpan semua dan sambungkan kepada visual basic anda dengan cara add refence microsoft word dan microsoft excel
Berikut adalah source code yang saya gunakan dala aplikasi ini
Public Class Form1
Dim ExcelAPP As New Microsoft.Office.Interop.Excel.Application
Dim ExcelBook As New Microsoft.Office.Interop.Excel.Workbook
Dim WordAPP As New Microsoft.Office.Interop.Word.Application
Dim WordDoc As New Microsoft.Office.Interop.Word.Document
Private Sub BtnHitung_Click(sender As Object, e As EventArgs) Handles BtnHitung.Click
If ComboBoxJasa1.Text = "Biasa" Then
TxtSatuan1.Text = "Kg" And TxtHarga1.Text =
TxtBerat1.Text * 8000
ElseIf ComboBoxJasa1.Text = "Cepat" Then
TxtSatuan1.Text = "Kg" And TxtHarga1.Text =
TxtBerat2.Text * 12000
ElseIf ComboBoxJasa1.Text = "Dry
Cleaning" Then
TxtSatuan1.Text = "Pieces" And TxtHarga1.Text =
TxtBerat2.Text * 16000
ElseIf ComboBoxJasa2.Text = "Biasa" Then
TxtSatuan2.Text = "Kg" And TxtHarga2.Text =
TxtBerat2.Text * 8000
ElseIf ComboBoxJasa2.Text = "Cepat" Then
TxtSatuan2.Text = "Kg" And TxtHarga2.Text =
TxtBerat2.Text * 12000
ElseIf ComboBoxJasa2.Text = "Dry
Cleaning" Then
TxtSatuan2.Text = "Pieces" And TxtHarga2.Text =
TxtBerat2.Text * 16000
End If
TxtTotal.Text = TxtHarga1.Text +
TxtHarga2.Text
End Sub
Private Sub BtnCetak_Click(sender As Object, e As EventArgs) Handles BtnCetak.Click
WordDoc = WordAPP.Docements.Open("C:\Users\Sony\Documents\UTS Lab Pemrograman\Data
Transaksi Malika Laundry.docx")
WordDoc.Bookmarks("nama").Select()
WordAPP.Selection.TypeText(TxtNama.Text)
WordDoc.Bookmarks("kode").Select()
WordAPP.Selection.TypeText(TxtKode.Text)
WordDoc.Bookmarks("nomor").Select()
WordAPP.Selection.TypeText(TxtNomor.Text)
WordDoc.Bookmarks("status").Select()
WordAPP.Selection.TypeText(ComboBoxStatus.Text)
WordDoc.Bookmarks("masuk").Select()
WordAPP.Selection.TypeText(TxtMasuk.Text)
WordDoc.Bookmarks("selesai").Select()
WordAPP.Selection.TypeText(TxtSelesai.Text)
WordDoc.Bookmarks("barang1").Select()
WordAPP.Selection.TypeText(TxtBarang1.Text)
WordDoc.Bookmarks("jasa1").Select()
WordAPP.Selection.TypeText(ComboBoxJasa1.Text)
WordDoc.Bookmarks("satuan1").Select()
WordAPP.Selection.TypeText(TxtSatuan1.Text)
WordDoc.Bookmarks("berat1").Select()
WordAPP.Selection.TypeText(TxtBerat1.Text)
WordDoc.Bookmarks("harga1").Select()
WordAPP.Selection.TypeText(TxtHarga1.Text)
WordDoc.Bookmarks("barang2").Select()
WordAPP.Selection.TypeText(TxtBarang2.Text)
WordDoc.Bookmarks("jasa2").Select()
WordAPP.Selection.TypeText(ComboBoxJasa2.Text)
WordDoc.Bookmarks("satuan2").Select()
WordAPP.Selection.TypeText(TxtSatuan2.Text)
WordDoc.Bookmarks("berat2").Select()
WordAPP.Selection.TypeText(TxtBerat2.Text)
WordDoc.Bookmarks("harga2").Select()
WordAPP.Selection.TypeText(TxtHarga2.Text)
WordDoc.Bookmarks("pewangi").Select()
WordAPP.Selection.TypeText(ComboBoxWangi.Text)
WordDoc.Bookmarks("catatan").Select()
WordAPP.Selection.TypeText(RichTextBox1.Text)
WordDoc.Bookmarks("total").Select()
WordAPP.Selection.TypeText(TxtTotal.Text)
WordDoc.SaveAs("C:\Users\Sony\Documents\UTS Lab Pemrograman\Data
Transaksi Malika Laundry.docx")
WordAPP.Visible = True
End Sub
Private Sub BtnSimpan_Click(sender As Object, e As EventArgs) Handles BtnSimpan.Click
ExcelBook = ExcelAPP.Workbooks.Open("C:\Users\Sony\Documents\UTS Lab Pemrograman\Data
Transaksi Malika Laundry.xlsx")
ExcelAPP.Range("A4").Value
= TxtNama.Text
ExcelAPP.Range("B4").Value
= TxtKode.Text
ExcelAPP.Range("C4").Value
= TxtNomor.Text
ExcelAPP.Range("D4").Value
= ComboBoxStatus.Text
ExcelAPP.Range("E4").Value
= TxtMasuk.Text
ExcelAPP.Range("F4").Value
= TxtSelesai.Text
ExcelAPP.Range("G4").Value
= TxtBarang1.Text
ExcelAPP.Range("H4").Value
= ComboBoxJasa1.Text
ExcelAPP.Range("I4").Value
= TxtSatuan1.Text
ExcelAPP.Range("J4").Value
= TxtBerat1.Text
ExcelAPP.Range("K4").Value
= TxtHarga1.Text
ExcelAPP.Range("L4").Value
= TxtBarang2.Text
ExcelAPP.Range("M4").Value
= ComboBoxJasa2.Text
ExcelAPP.Range("N4").Value
= TxtSatuan2.Text
ExcelAPP.Range("O4").Value
= TxtBerat2.Text
ExcelAPP.Range("P4").Value
= TxtHarga2.Text
ExcelAPP.Range("Q4").Value
= TxtTotal.Text
ExcelBook.SaveAs("C:\Users\Sony\Documents\UTS Lab Pemrograman\Data
Transaksi Malika Laundry.xlsx")
End Sub
End Class
Anda akan menginput semua informasi atau data yang diperlukan.
Output pertama jika anda klik button Hitung, akan menghitung total harga keseluruhan yang harus dibayar oleh pelanggan
Output kedua jika anda klik button simpan, data akan otomatis berpindah atau masuk kedalam data transaksi dalam excel yang sudah anda buat.
Output kedua jika anda klik button cetak, data akan otomatis berpindah atau masuk kedalam data transaksi dalam word yang sudah anda buat.
Rabu, 08 Juni 2016
Membuat Aplikasi Pembayaran dengan Visual Basic
Hai! Kali ini saya akan menunjukkan bagaimana membuat Aplikasi Pembayaran pada sebuah warung makan
Step 1 : Buatlah design form sesuai yang anda inginkan atau bisa membuat form seperti contoh ini dan jangan lupa untuk membuat file Excel CSV
ComboBox1 = Nama Kasir
DateTimePicker1 = menampilkan pilihan tanggal
ComboBox2 hingga ComboBox6 = Jenis pesanan makanan
TextBox1 hingga TextBox5 = Jumlah pesanan makanan
TextBox6 hingga TextBox10 = Harga pesanan makanan
TextBox11 = Total harga makanan
ComboBox7 hingga ComboBox11 = Jenis pesanan minuman
TextBox12 hingga TextBox16 = Jumlah pesanan minuman
TextBox17 hingga TextBox21 = Harga pesanan minuman
TextBox22 = Total harga minuman
TextBox23 = Total harga makanan dan minuman
TextBox24 = Bayar, jumlah uang yang di berikan customer
TextBox25 = Kembali, jumlah uang yang di berikan customer di kurang total harga makanan dan minuman
BtnTotal = Total harga makanan dan minuman
BtnHitung = menghasilkan TextBox25
BtnHapus = menghapus semua data
BtnSimpan = menyimpan data di excel dan akan muncul di ListBox1
Step 2 : Berikut Source Code dari aplikasi ini
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
If ComboBox2.Text = "Nasi Goreng" Then
TextBox6.Text = Val(TextBox1.Text) * 20000
ElseIf ComboBox2.Text = "Bakso" Then
TextBox6.Text = Val(TextBox1.Text) * 10000
ElseIf ComboBox2.Text = "Mie Ayam Bakso" Then
TextBox6.Text = Val(TextBox1.Text) * 15000
ElseIf ComboBox2.Text = "Kwetiau" Then
TextBox6.Text = Val(TextBox1.Text) * 12000
Else
TextBox6.Text = Val(TextBox1.Text) * 7000
End If
End Sub
Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs) Handles TextBox2.TextChanged
If ComboBox3.Text = "Nasi Goreng" Then
TextBox7.Text = Val(TextBox2.Text) * 20000
ElseIf ComboBox3.Text = "Bakso" Then
TextBox7.Text = Val(TextBox2.Text) * 10000
ElseIf ComboBox3.Text = "Mie Ayam Bakso" Then
TextBox7.Text = Val(TextBox2.Text) * 15000
ElseIf ComboBox3.Text = "Kwetiau" Then
TextBox7.Text = Val(TextBox2.Text) * 12000
Else
TextBox7.Text = Val(TextBox2.Text) * 7000
End If
End Sub
Private Sub TextBox3_TextChanged(sender As Object, e As EventArgs) Handles TextBox3.TextChanged
If ComboBox4.Text = "Nasi Goreng" Then
TextBox8.Text = Val(TextBox3.Text) * 20000
ElseIf ComboBox4.Text = "Bakso" Then
TextBox8.Text = Val(TextBox3.Text) * 10000
ElseIf ComboBox4.Text = "Mie Ayam Bakso" Then
TextBox8.Text = Val(TextBox3.Text) * 15000
ElseIf ComboBox4.Text = "Kwetiau" Then
TextBox8.Text = Val(TextBox3.Text) * 12000
Else
TextBox8.Text = Val(TextBox3.Text) * 7000
End If
End Sub
Private Sub TextBox4_TextChanged(sender As Object, e As EventArgs) Handles TextBox4.TextChanged
If ComboBox5.Text = "Nasi Goreng" Then
TextBox9.Text = Val(TextBox4.Text) * 20000
ElseIf ComboBox5.Text = "Bakso" Then
TextBox9.Text = Val(TextBox4.Text * 10000
ElseIf ComboBox5.Text = "Mie Ayam Bakso" Then
TextBox9.Text = Val(TextBox4.Text * 15000
ElseIf ComboBox5.Text = "Kwetiau" Then
TextBox9.Text = Val(TextBox4.Text * 12000
Else
TextBox9.Text = Val(TextBox4.Text * 7000
End If
End Sub
Private Sub TextBox5_TextChanged(sender As Object, e As EventArgs) Handles TextBox5.TextChanged
If ComboBox6.Text = "Nasi Goreng" Then
TextBox10.Text = Val(TextBox5.Text) * 20000
ElseIf ComboBox6.Text = "Bakso" Then
TextBox10.Text = Val(TextBox5.Text) * 10000
ElseIf ComboBox6.Text = "Mie Ayam Bakso" Then
TextBox10.Text = Val(TextBox5.Text) * 15000
ElseIf ComboBox6.Text = "Kwetiau" Then
TextBox10.Text = Val(TextBox5.Text) * 12000
Else
TextBox10.Text = Val(TextBox5.Text) * 7000
End If
End Sub
Private Sub TextBox12_TextChanged(sender As Object, e As EventArgs) Handles TextBox12.TextChanged
If ComboBox7.Text = "Teh Botol" Then
TextBox17.Text = Val(TextBox12.Text) * 4000
ElseIf ComboBox7.Text = "Es Jeruk" Then
TextBox17.Text = Val(TextBox12.Text) * 4000
ElseIf ComboBox7.Text = "Es Campur" Then
TextBox17.Text = Val(TextBox12.Text) * 8000
ElseIf ComboBox7.Text = "Fanta Susu" Then
TextBox17.Text = Val(TextBox12.Text) * 5000
Else
TextBox17.Text = Val(TextBox12.Text) * 3000
End If
End Sub
Private Sub TextBox13_TextChanged(sender As Object, e As EventArgs) Handles TextBox13.TextChanged
If ComboBox8.Text = "Teh Botol" Then
TextBox18.Text = Val(TextBox13.Text) * 4000
ElseIf ComboBox8.Text = "Es Jeruk" Then
TextBox18.Text = Val(TextBox13.Text) * 4000
ElseIf ComboBox8.Text = "Es Campur" Then
TextBox18.Text = Val(TextBox13.Text) * 8000
ElseIf ComboBox8.Text = "Fanta Susu" Then
TextBox18.Text = Val(TextBox13.Text) * 5000
Else
TextBox18.Text = Val(TextBox13.Text) * 3000
End If
End Sub
Private Sub TextBox14_TextChanged(sender As Object, e As EventArgs) Handles TextBox14.TextChanged
If ComboBox9.Text = "Teh Botol" Then
TextBox19.Text = Val(TextBox14.Text) * 4000
ElseIf ComboBox9.Text = "Es Jeruk" Then
TextBox19.Text = Val(TextBox14.Text) * 4000
ElseIf ComboBox9.Text = "Es Campur" Then
TextBox19.Text = Val(TextBox14.Text) * 8000
ElseIf ComboBox9.Text = "Fanta Susu" Then
TextBox19.Text = Val(TextBox14.Text) * 5000
Else
TextBox17.Text = Val(TextBox12.Text) * 3000
End If
End Sub
Private Sub TextBox15_TextChanged(sender As Object, e As EventArgs) Handles TextBox15.TextChanged
If ComboBox10.Text = "Teh Botol" Then
TextBox20.Text = Val(TextBox15.Text) * 4000
ElseIf ComboBox10.Text = "Es Jeruk" Then
TextBox20.Text = Val(TextBox15.Text) * 4000
ElseIf ComboBox10.Text = "Es Campur" Then
TextBox20.Text = Val(TextBox15.Text) * 8000
ElseIf ComboBox10.Text = "Fanta Susu" Then
TextBox20.Text = Val(TextBox15.Text) * 5000
Else
TextBox20.Text = Val(TextBox15.Text) * 3000
End If
End Sub
Private Sub TextBox16_TextChanged(sender As Object, e As EventArgs) Handles TextBox16.TextChanged
If ComboBox11.Text = "Teh Botol" Then
TextBox21.Text = Val(TextBox16.Text) * 4000
ElseIf ComboBox11.Text = "Es Jeruk" Then
TextBox21.Text = Val(TextBox16.Text) * 4000
ElseIf ComboBox11.Text = "Es Campur" Then
TextBox21.Text = Val(TextBox16.Text) * 8000
ElseIf ComboBox11.Text = "Fanta Susu" Then
TextBox21.Text = Val(TextBox16.Text) * 5000
Else
TextBox21.Text = Val(TextBox16.Text) * 3000
End If
End Sub
Private Sub BtnTotal_Click(sender As Object, e As EventArgs) Handles BtnTotal.Click
TextBox11.Text = Val(TextBox6.Text) + Val(TextBox7.Text) + Val(TextBox8.Text) + Val(TextBox9.Text) + Val(TextBox10.Text)
TextBox22.Text = Val(TextBox17.Text) + Val(TextBox18.Text) + Val(TextBox19.Text) + Val(TextBox20.Text) + Val(TextBox21.Text)
TextBox23.Text = TextBox1.Text + TextBox22.Text
End Sub
Private Sub BtnHitung_Click(sender As Object, e As EventArgs) Handles BtnHitung.Click
TextBox25.Text = TextBox24.Text - TextBox23.Text
End Sub
Private Sub BtnHapus_Click(sender As Object, e As EventArgs) Handles BtnHapus.Click
ComboBox1.Text = ""
ComboBox2.Text = ""
ComboBox3.Text = ""
ComboBox4.Text = ""
ComboBox5.Text = ""
ComboBox6.Text = ""
ComboBox7.Text = ""
ComboBox8.Text = ""
ComboBox9.Text = ""
ComboBox10.Text = ""
ComboBox11.Text = ""
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""
TextBox9.Text = ""
TextBox10.Text = ""
TextBox11.Text = ""
TextBox12.Text = ""
TextBox13.Text = ""
TextBox14.Text = ""
TextBox15.Text = ""
TextBox16.Text = ""
TextBox17.Text = ""
TextBox18.Text = ""
TextBox19.Text = ""
TextBox20.Text = ""
TextBox21.Text = ""
TextBox22.Text = ""
TextBox23.Text = ""
TextBox24.Text = ""
TextBox25.Text = ""
ListBox1.Text = ""
End Sub
Private Sub BtnSimpan_Click(sender As Object, e As EventArgs) Handles BtnSimpan.Click
Dim nofile As Integer
Dim var1, var2, var3, var4, var5, var6, var7 As String
nofile = FreeFile()
FileOpen(nofile, "C:\Users\Velly\Desktop\Data Transaksi Pembayaran.CSV", OpenMode.Append)
var1 = ComboBox1.Text
var2 = DateTimePicker1.Text
var3 = ComboBox2.Text & ComboBox3.Text & ComboBox4.Text & ComboBox5.Text & ComboBox6.Text
var4 = TextBox11.Text
var5 = ComboBox7.Text & ComboBox8.Text & ComboBox9.Text & ComboBox10.Text & ComboBox11.Text
var6 = TextBox22.Text
var7 = TextBox23.Text
ListBox1.Items.Add(var1 & "---" & var2 & "---" & var3 & "---" & var4 & "---" & var5 & "---" & var6 & "---" & var7 & "---")
WriteLine(1, var1, var2, var3, var4, var5, var6, var7)
FileClose(1)
End Sub
End Class
Selasa, 05 April 2016
Membuat Form Pemesanan Tiket dengan VB
Hallo! Disini saya akan memberikan contoh bagaimana membuat program pemesan tiket konser menggunakan Visual Basic.
1. Buatlah design form Pemesanan Tiket konser sesuai dengan apa yang kamu inginkan atau buat seperti contoh di bawah ini
Source Code
Public Class Form1
Sub hapus()
TxtNama.Text = ""
TxtNoId.Text = ""
ComboBoxTgl.Text = ""
ComboBoxBln.Text = ""
ComboBoxThn.Text = ""
ComboBoxTiket.Text = ""
TxtHarga.Text = ""
ComboBoxBanyak.Text = ""
TxtTotal.Text = ""
TxtNama.Focus()
End Sub
Function total(ByVal HargaTiket, ByVal BanyakTiket)
total = (HargaTiket * BanyakTiket)
End Function
Private Sub BtnHapus_Click(sender As Object, e As EventArgs) Handles BtnHapus.Click
Call hapus()
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
For a = 1 To 31
ComboBoxTgl.Items.Add(a)
Next
For b = 1 To 12
ComboBoxBln.Items.Add(b)
Next
For c = 1997 To 1966 Step -1
ComboBoxThn.Items.Add(c)
Next
Dim i As Integer
ComboBoxBanyak.Items.Clear()
i = 4
While i > 0
ComboBoxBanyak.Items.Add(i)
i -= 1
End While
End Sub
Private Sub BtnBeli_Click(sender As Object, e As EventArgs) Handles BtnBeli.Click
Dim x = MsgBox("Yakin Anda Telah Selesai Melakukan Pemesanan?", MsgBoxStyle.YesNo + MsgBoxStyle.Question, "Konfirmasi")
If x = vbYes Then
Me.Close()
End If
End Sub
Private Sub BtnLihat_Click(sender As Object, e As EventArgs) Handles BtnLihat.Click
Form2.Show()
End Sub
Private Sub BtnTotal_Click(sender As Object, e As EventArgs) Handles BtnTotal.Click
TxtTotal.Text = total(TxtHarga.Text, ComboBoxBanyak.Text)
End Sub
Private Sub TxtHarga_TextChanged(sender As Object, e As EventArgs) Handles TxtHarga.TextChanged
If ComboBoxTiket.Text = "Daily Pass 4 Maret 2016" Then
TxtHarga.Text = "550000"
ElseIf ComboBoxTiket.Text = "Daily Pass 5 Maret 2016" Then
TxtHarga.Text = "550000"
ElseIf ComboBoxTiket.Text = "Daily Pass 6 Maret 2016" Then
TxtHarga.Text = "550000"
ElseIf ComboBoxTiket.Text = "3 Days Pass 4-6 Maret 2016" Then
TxtHarga.Text = "1400000"
Else
TxtHarga.Text = "1250000"
End If
End Sub
Private Sub Label9_Click(sender As Object, e As EventArgs) Handles Label9.Click
Select Case ComboBoxBanyak.Text
Case 1
Label9.Text = "Anda mendapatkan 1 tiket"
Case 2
Label9.Text = "Anda mendapatkan 2 tiket"
Case 3
Label9.Text = "Anda mendapatkan 3 tiket"
Case Else
Label9.Text = "Anda mendapatkan 3 tiket"
End Select
End Sub
End Class
3. Dan inilah hasilnya jika klik button Total
4. Jika klik tombol lihat yang akan keluar jadi seperti ini
Sabtu, 26 Maret 2016
Rabu, 23 Maret 2016
Membuat Array dengan C#
1. Buatlah form dengan C# dan pilih "Console Application"
2. Lalu masukkan coding seperti contoh berikut:
3. Dan inilah hasilnya
Membuat Progress Bar dengan C#
1. Buatlah form sesuai yang anda inginkan dan jangan lupa tambahkan "Progress Bar" yang terdapat di Toolbox
2. Masukkan coding sesuai yang diingkan seperti contoh berikut:
3. Dan hasilnya akan seperti ini jika yang di entry adalah sebuah angka
Selamat Mencoba!
Membuat IF ELSE dengan C#
1. Buatlah form sesuai yang anda inginkan, seperti contoh ini
2. Kemudian klik button untuk memasukkan source code yang diinginkan
contoh coding di atas adalah sebagai berikut:
Dan hasilnya jika ia memasukkan kata "Merah", "Biru", "Kuning", "Hijau" maka hasilnya akan benar, selain itu salah
Langganan:
Postingan (Atom)