Minggu, 22 April 2018

program penjualan pulsa menggunakan VB.net

saya sukma rahayu utami dari kelas 04TPLP002 Mahasiswa dari STMIK ERESHA
kali ini saya memposting tugas mata kuliah pemograman. Mengenai pembuatan aplikasi penjualan pulsa yang bisa langsung save ke word
ini lah design aplikasi yang sederhana




  Cara membuat programnya   

1. buka lah visual studio anda  --> new projek   Jangan lupa beri nama projek tersebut ya 


2.buat design seperti yang ini 


keterangan :
-saya di sini menggunakan 9 lable untuk ( no hp, opreator, jumlah pulsa, harga, pembayaran, kembalian, Tanggal transaksi , tanggal, bulan, tahun)
-menggunakan 4 combox di kolom (jumlah pulsa, tanggal, tahun)
- menggunakan 3 button ( cek harga, hitung, cetak)
- menggunakan radio button ( indosat, telkomsel, smartfren, xl, axis, 3  )
-menggunakan 1 picturebox

3. lalu begini lah scriptmya 




Imports word = Microsoft.Office.Interop.Word
Public Class Form1

    Private Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton1.CheckedChanged
        oprator.Text = RadioButton1.Text
        PictureBox1.Image = System.Drawing.Image.FromFile("C:\Users\Uma\Downloads\logo-indosat-ooredoo.jpg")
    End Sub

    Private Sub RadioButton2_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton2.CheckedChanged
        oprator.Text = RadioButton2.Text
        PictureBox1.Image = System.Drawing.Image.FromFile("C:\Users\Uma\Downloads\images.jpg")
    End Sub

    Private Sub RadioButton3_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton3.CheckedChanged
        oprator.Text = RadioButton3.Text
        PictureBox1.Image = System.Drawing.Image.FromFile("C:\Users\Uma\Downloads\Smartfren-Logo-Header.jpg")
    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        ComboBox1.Items.Add("5")
        ComboBox1.Items.Add("10")
        ComboBox1.Items.Add("20")
        ComboBox1.Items.Add("25")
        ComboBox1.Items.Add("50")
        ComboBox1.Items.Add("100")
        Dim tanggal As Integer
        Dim bulan As Integer
        Dim tahun As Integer
        For tanggal = 1 To 31
            ComboBox2.Items.Add(tanggal)

        Next
        For tahun = 2018 To 2035
            ComboBox4.Items.Add(tahun)
        Next

        ComboBox3.Items.Add("Januari")
        ComboBox3.Items.Add("Februari")
        ComboBox3.Items.Add("Maret")
        ComboBox3.Items.Add("April")
        ComboBox3.Items.Add("Mei")
        ComboBox3.Items.Add("Juni")
        ComboBox3.Items.Add("Juli")
        ComboBox3.Items.Add("Agustus")
        ComboBox3.Items.Add("September")
        ComboBox3.Items.Add("Oktober")
        ComboBox3.Items.Add("November")
        ComboBox3.Items.Add("Desember")
       
    End Sub

    Private Sub RadioButton5_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton5.CheckedChanged
        oprator.Text = RadioButton5.Text
        PictureBox1.Image = System.Drawing.Image.FromFile("C:\Users\Uma\Downloads\XL-Axiata-Logo.jpg")

    End Sub

    Private Sub RadioButton6_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton6.CheckedChanged
        oprator.Text = RadioButton6.Text
        PictureBox1.Image = System.Drawing.Image.FromFile("C:\Users\Uma\Downloads\index.jpg")
    End Sub

    Private Sub RadioButton4_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton4.CheckedChanged
        oprator.Text = RadioButton4.Text
        PictureBox1.Image = System.Drawing.Image.FromFile("C:\Users\Uma\Downloads\tri_20180105_121526.jpg")
    End Sub

    Private Sub hitung_Click(sender As Object, e As EventArgs) Handles hitung.Click
        Select Case ComboBox1.Text
            Case "5"
                harga.Text = ("7500")
            Case "10"
                harga.Text = ("12500")
            Case "20"
                harga.Text = ("22500")
            Case "25"
                harga.Text = ("27500")
            Case "50"
                harga.Text = ("53500")
            Case "100"
                harga.Text = ("105500")

        End Select
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        kembalian.Text = pembayaran.Text - harga.Text
    End Sub

    Private Sub cetak_Click(sender As Object, e As EventArgs) Handles cetak.Click
        Dim aplikasi As New word.Application
        Dim filenya As New word.Document
        filenya = aplikasi.Documents.Open("C:\Users\Uma\Documents\PENJUALAN PULSA ONLINE2.docx")

        filenya.Bookmarks("N").Select()
        aplikasi.Selection.TypeText(no.Text)

        filenya.Bookmarks("O").Select()
        aplikasi.Selection.TypeText(oprator.Text)

        filenya.Bookmarks("J").Select()
        aplikasi.Selection.TypeText(ComboBox1.Text)

        filenya.Bookmarks("H").Select()
        aplikasi.Selection.TypeText(harga.Text)

        filenya.Bookmarks("P").Select()
        aplikasi.Selection.TypeText(pembayaran.Text)

        filenya.Bookmarks("K").Select()
        aplikasi.Selection.TypeText(kembalian.Text)

        filenya.Bookmarks("T").Select()
        aplikasi.Selection.TypeText(ComboBox2.Text + " ")
        aplikasi.Selection.TypeText(ComboBox3.Text + " ")
        aplikasi.Selection.TypeText(ComboBox4.Text + " ")

        filenya.SaveAs2("C:\Users\Uma\Documents\PENJUALAN PULSA ONLINE2A.docx")
        MsgBox("sukses")

        aplikasi.Visible = True
       
    End Sub
End Class

4. perlu di perhatikan ketika  ingin menyambungkan kie word
   cekidottt.....

      - buat lah  word save dengan baik dan benar




    - kemudian beri bookmark seperti di bawah ini





semoga bermanfat untuk kalian semua




Tidak ada komentar:

Posting Komentar

MEMBUAT APLIKASI ZIKIR ALMASUROT DI ECLIPSE

Assalammualaikum wr,wb kali ini saya akan mempost project UAS saya berbasis aplikasi  yang menggunakan eclipse, Aplikasi yang saya buat ada...