Tuesday, 24 October 2017

Contoh Program Sederhana Pembayaran Listrik

Contoh Source Code:

Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        cmb_golongan.Items.Add("A")
        cmb_golongan.Items.Add("B")
        cmb_golongan.Items.Add("C")
        tb_nometer.Enabled = False
        tb_nmpelanggan.Enabled = False
        tb_totalbayar.Enabled = False
        tb_alamatpelanggan.Enabled = False
    End Sub

    Private Sub tb_nopel_TextChanged(Sender As Object, e As EventArgs) Handles tb_nopel.TextChanged
        If tb_nopel.Text = "001" Then
            tb_nometer.Text = "101"
            tb_nmpelanggan.Text = "Boby"
            tb_alamatpelanggan = "Baloi"
        ElseIf tb_nopel.Text = "001" Then
            tb_nometer.Text = "102"
            tb_nmpelanggan.Text = "Nia"
            tb_alamatpelanggan = "Nongsa"
        Else
            MessageBox.Show("Maaf, Nomor Pelangan Tidak Terdaftar", "Sorry", MessageBoxButtons.OK)
            tb_nopel.Text = ""
        End If
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim gol, total As Integer
        If tb_nopel.Text <> "" Then
            MessageBox.Show("Maaf, Nomor Pelangan Tidak Ada", "Sorry", MessageBoxButtons.OK)
        Else
            If cmb_golongan.Text = "A" Then
                gol = 5000
            ElseIf cmb_golongan.Text = "B" Then
                gol = 6000
            ElseIf cmb_golongan.Text = "C" Then
                gol = 7000
            End If

            total = gol + (Convert.ToInt32(tb_jmlpakai.Text) * Convert.ToInt32(tb_hpm.Text)) + Convert.ToInt32(tb_faktur.Text) + Convert.ToInt32(tb_materai.Text) + Convert.ToInt32(tb_tunggakan.Text) + Convert.ToInt32(tb_denda.Text) + Convert.ToInt32(tb_admin.Text)
        End If
        tb_totalbayar.Text = total
    End Sub
End Class

No comments:

Post a Comment

Odoo 11 - Create a new sample module

How To Create or Develop a Custom Module in Odoo 11 In this blog, we‘ll be focusing on how we can create or develop a custom mo...