assalamualaikum.wr.wb
program saya tentang penjualan jenis kopi,pengoprasian nya user memilih kode yg sudah di berikan ,,kode yg di pilih sudah automatis nama,dan harga ..untuk pembelian nya harga di kali jumlah harga ,data yg sudah di hitung bisa tersimpan di ms.word ms.excel..
Contoh Design :
Source Code :
Source Code Button Hitung :
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
TxtTotal.Text = TxtHarga.Text * TxtJumlah.Text
End Sub
Source Code Button MS.Word:
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim apk As New word.Application
Dim doc As New word.Document
doc = apk.Documents.Open("D:\STMIK ERESHA\Mata Kuliah\IV\Tugas Pemograman\AlFAT\Jenis Kopi.docx")
doc.Bookmarks("Jenis").Select()
apk.Selection.TypeText(ComboBox1.Text)
doc.Bookmarks("Harga").Select()
apk.Selection.TypeText(TxtHarga.Text)
doc.Bookmarks("Jumlah").Select()
apk.Selection.TypeText(TxtJumlah.Text)
doc.Bookmarks("Total").Select()
apk.Selection.TypeText(TxtTotal.Text)
doc.SaveAs("D:\STMIK ERESHA\Mata Kuliah\IV\Tugas Pemograman\AlFAT\Jenis Kopi12.docx")
MsgBox("Sukses")
apk.Visible = True
End Sub
Source Code Combo Box :
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
If ComboBox1.Text = "Kopi Vietnam Drip" Then
TxtHarga.Text = "40000"
ElseIf ComboBox1.Text = "Kopi Expresso" Then
TxtHarga.Text = "15000"
ElseIf ComboBox1.Text = "Kopi Item" Then
TxtHarga.Text = "15000"
End If
End Sub
Source Code MS.Excel:
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim apk As New excel.Application
Dim WBl As excel.Workbook
WBl = apk.Workbooks.Open("D:\STMIK ERESHA\Mata Kuliah\IV\Tugas Pemograman\AlFAT\Book1.xlsx")
apk.Range("A2").Value = ComboBox1.Text
apk.Range("B2").Value = TxtHarga.Text
apk.Range("C2").Value = TxtJumlah.Text
apk.Range("D2").Value = TxtTotal.Text
WBl.SaveAs("D:\STMIK ERESHA\Mata Kuliah\IV\Tugas Pemograman\AlFAT\Book1xx.xlsx")
apk.Visible = True
End Sub
Source Code form:
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
ComboBox1.Items.Add("Kopi Vietnam Drip")
ComboBox1.Items.Add("Kopi Expresso")
ComboBox1.Items.Add("Kopi Item")
End Sub
screen shot: Hasil Run