Scrip Form Login :
Public Class Form2
Private Sub BtnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnLogin.Click
If UserNM.Text = "Dhany Pranata" And Password.Text = "simanjuntak" Then
Menu_Utama.Show()
Me.Hide()
Else
MsgBox("Data Username/Password Anda Salah!!")
UserNM.Text = ""
Password.Text = ""
End If
End Sub
Private Sub BtnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnExit.Click
End
End Sub
End Class
Tampilan Program Login :
Scrip Menu Utama :
Public Class Menu_Utama
Private Sub DataPDAMToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataPDAMToolStripMenuItem.Click
Form1.Show()
End Sub
Private Sub Form3_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
e.Cancel = True
If MsgBox("Anda Yakin Ingin Keluar?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
Me.Hide()
End If
End Sub
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
End
End Sub
End ClassTampilan Program Menu Utama :
Scrip Data Pelanggan :
Public Class Form1
Sub ISIKdPelanggan()
KdPelangan.Items.Add("TOK-MED-")
KdPelangan.Items.Add("TOK-BEL-001")
KdPelangan.Items.Add("TOK-TEM-001")
KdPelangan.Items.Add("TOK-MAR-001")
KdPelangan.Items.Add("TOK-BIN-001")
KdPelangan.Items.Add("TOK-PAK-001")
KdPelangan.Items.Add("RUM-MED-001")
KdPelangan.Items.Add("RUM-BEL-001")
KdPelangan.Items.Add("RUM-TEM-001")
KdPelangan.Items.Add("RUM-MAR-001")
KdPelangan.Items.Add("RUM-BIN-001")
KdPelangan.Items.Add("RUM-PAK-001")
KdPelangan.Items.Add("SWA-MED-001")
KdPelangan.Items.Add("SWA-BEL-001")
KdPelangan.Items.Add("SWA-TEM-001")
KdPelangan.Items.Add("SWA-MAR-001")
KdPelangan.Items.Add("SWA-BIN-001")
KdPelangan.Items.Add("SWA-PAK-001")
KdPelangan.Items.Add("PAB-MED-001")
KdPelangan.Items.Add("PAB-BEL-001")
KdPelangan.Items.Add("PAB-TEM-001")
KdPelangan.Items.Add("PAB-MAR-001")
KdPelangan.Items.Add("PAB-BIN-001")
KdPelangan.Items.Add("PAB-PAK-001")
End Sub
Sub kodeplgCOMBO()
Dim A, B, C As String
A = Microsoft.VisualBasic.Left(KdPelangan.Text, 3)
B = Microsoft.VisualBasic.Mid(KdPelangan.Text, 5, 3)
C = Microsoft.VisualBasic.Right(KdPelangan.Text, 3)
No_urut.Text = C
If A = "TOK" Then
TypPlanggan.Text = "Toko"
Beban.Text = 25000
HargaM3.Text = 300
ElseIf A = "RUM" Then
TypPlanggan.Text = "Rumah"
Beban.Text = 15000
HargaM3.Text = 100
ElseIf A = "SWA" Then
TypPlanggan.Text = "Swalayan"
Beban.Text = 10000
HargaM3.Text = 200
ElseIf A = "PAB" Then
TypPlanggan.Text = "Pabrik"
Beban.Text = 250000
HargaM3.Text = 500
End If
If B = "MED" Then
NmDaerah.Text = "Medan"
ElseIf B = "BEL" Then
NmDaerah.Text = "Belawan"
ElseIf B = "TEM" Then
NmDaerah.Text = "Aksara"
ElseIf B = "MAR" Then
NmDaerah.Text = "Marendal"
ElseIf B = "BIN" Then
NmDaerah.Text = "Binjay"
ElseIf B = "PAK" Then
NmDaerah.Text = "Lubuk Pakam"
End If
End Sub
Private Sub Rata_rata_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Rata_rata.KeyPress
If Asc(e.KeyChar) = 13 Then
PerBulan.Text = Rata_rata.Text * 30
Total.Text = PerBulan.Text * HargaM3.Text + Val(Beban.Text)
Pajak.Text = 0.01 * Total.Text
Pembayaran.Text = Val(Total.Text) + Val(Pajak.Text)
End If
End Sub
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
If Asc(e.KeyChar) = 13 Then
PerBulan.Text = Rata_rata.Text * 30
Total.Text = PerBulan.Text * HargaM3.Text + Val(Beban.Text)
Pajak.Text = 0.01 * Total.Text
Pembayaran.Text = Val(Total.Text) + Val(Pajak.Text)
End If
End Sub
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
e.Cancel = True
If MsgBox("Anda Yakin Keluar?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
Me.Hide()
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ISIKdPelanggan()
End Sub
Private Sub KDP_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
kodeplgCOMBO()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
KdPelangan.Visible = False
Cara.Visible = False
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
KdPelangan.Visible = True
Cara.Visible = False
End Sub
Private Sub Rata_rata_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Rata_rata.TextChanged
If Not IsNumeric(Rata_rata.Text) Then
Rata_rata.Clear()
End If
End Sub
Private Sub BtnHapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnHapus.Click
Hapus(Me)
KdPelangan.Focus()
End Sub
Sub Hapus(ByVal F As Form)
Dim x As Object
For Each x In F.Controls
If TypeOf x Is TextBox Then x.text = ""
If TypeOf x Is ComboBox Then x.text = ""
Next
End Sub
Private Sub KdPelangan_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KdPelangan.SelectedIndexChanged
kodeplgCOMBO()
End Sub
Private Sub BtnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnExit.Click
End
End Sub
End Class