Program
ini adalah langkah untuk membuat From
Login
Public Class Form1
Private Sub Form1_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Password.PasswordChar = "*"
End Sub
Private Sub Btn_OK_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Btn_OK.Click
If
Username.Text = "Rina" And Password.Text = "1303"
Then
MsgBox("Selamat
Datang")
Form2.Show()
Else
MsgBox("Maaf!
Password Anda SALAH!")
Username.Text = ""
Password.Text = ""
Username.Focus()
End If
End Sub
Private Sub Btn_Keluar_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Btn_Keluar.Click
End
End Sub
End Class
Selanjutnya :
Program from Menu
Public Class Form2
Private Sub FormToolStripMenuItem_Click(ByVal sender As
System.Object,
ByVal e As
System.EventArgs) Handles
FormToolStripMenuItem.Click
End Sub
Private Sub Form3ToolStripMenuItem_Click(ByVal sender As
System.Object,
ByVal e As
System.EventArgs) Handles
Form3ToolStripMenuItem.Click
Form3.Show()
Me.Hide()
End Sub
Private Sub EnkripsiToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
EnkripsiToolStripMenuItem.Click
Form4.Show()
Me.Hide()
End Sub
Private Sub Form2_Load(ByVal
sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
End Sub
End Class
Selanjutnya:
Program penggajian
Public Class Form3
Private Sub Form3_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
NIK.Items.Add("PM010")
NIK.Items.Add("PS111")
NIK.Items.Add("KU101")
NIK.Items.Add("GD100")
NIK.Items.Add("PM011")
Jabatan.Items.Add("Kepala Devisi")
Jabatan.Items.Add("Staff")
Jabatan.Items.Add("Wakil Kepala")
Status.Items.Add("Menikah")
Status.Items.Add("Tidak Menikah")
Jumlah.Items.Add("0")
Jumlah.Items.Add("1")
Jumlah.Items.Add("2")
End Sub
Private Sub NIK_SelectedIndexChanged(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
NIK.SelectedIndexChanged
Dim x As String
x =
Microsoft.VisualBasic.Left(NIK.Text, 2)
If x = "PM" Then
Bagian.Text = "Pemasaran"
ElseIf
x = "PS" Then
Bagian.Text = "Personalia"
ElseIf
x = "KU" Then
Bagian.Text = "Keuangan"
ElseIf
x = "GD" Then
Bagian.Text = "Gudang"
End If
If
NIK.Text = "PM010" Then
Nama.Text = "Cahyo"
ElseIf
NIK.Text = "PS111" Then
Nama.Text = "Steven"
ElseIf
NIK.Text = "KU101" Then
Nama.Text = "Doni"
ElseIf
NIK.Text = "GD100" Then
Nama.Text = "Dasner"
ElseIf
NIK.Text = "PM011" Then
Nama.Text = "Risky"
End If
End Sub
Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
Jabatan.SelectedIndexChanged
Select Case Jabatan.Text
Case
"Kepala Devisi"
Gaji.Text = "5000000"
Case
"Staff"
Gaji.Text = "2000000"
Case
"Wakil Kepala"
Gaji.Text = "3500000"
End Select
Pajak.Text = Gaji.Text * 0.1
End Sub
Private Sub Status_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
Status.SelectedIndexChanged
TK.Text = Gaji.Text * 0.15
If
Status.Text = "Menikah" Then
TK.Text = 0.15 * Gaji.Text
ElseIf
Status.Text = "Tidak Menikah" Then
TK.Text = 0
End If
End Sub
Private Sub Jumlah_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles
Jumlah.KeyPress
If
e.KeyChar = Chr(13) Then
Select
Case Jumlah.Text
Case
"0"
TA.Text = 0
Case
"1"
TA.Text = Gaji.Text * 0.05
Case
"2"
TA.Text = Gaji.Text * 0.1
Case
Else
TA.Text = Gaji.Text * 0.5
End
Select
End If
Total.Text = (Gaji.Text) + Val(TA.Text)
+ Val(TK.Text) - Pajak.Text
Total.Enabled = False
End Sub
Private Sub Btn_Hapus_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Btn_Hapus.Click
NIK.Text = ""
Nama.Text = ""
Bagian.Text = ""
Jabatan.Text = ""
Gaji.Text = ""
Pajak.Text = ""
Status.Text = ""
Jumlah.Text = ""
TK.Text = ""
TA.Text = ""
Total.Text = ""
End Sub
Private Sub Btn_Keluar_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Btn_Keluar.Click
End
End Sub
End Class
Selanjutnya:
Program Enkripsi ,Dekripsi
Public Class Form4
Private Sub Form4_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Btnen_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Btnen.Click
Dim x As String = ""
Dim
xkalimat As String
= ""
For i =
1 To Len(TextBox1.Text)
x = Mid(TextBox1.Text, i, i)
x = Chr(Asc(x) + 3)
xkalimat = xkalimat + x
Next
TextBox2.Text = xkalimat
End Sub
Private Sub Btnde_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Btnde.Click
Dim x As String = ""
Dim
xkalimat As String
= ""
For i =
1 To Len(TextBox1.Text)
x = Mid(TextBox1.Text, i, i)
x = Chr(Asc(x) - 3)
xkalimat = xkalimat + x
Next
TextBox2.Text = xkalimat
End Sub
End Class
Ingin mampelajari lebih lanjut klik Belajar Bahasa Pemrograman
Tidak ada komentar:
Posting Komentar