1. Buka aplikasi lalu pilih file. Seperti gambar di
bawah ini
4. Buka file yang telah kita simpan tadi. Liaht gambar di bawah ini
Source Coding:
FORM 1
Public Class Form1
Private Sub HitungGajiToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
HitungGajiToolStripMenuItem.Click
Dim
frm2 As New
Form2
frm2.MdiParent = Me
frm2.Show()
End Sub
Private Sub BukaSlipGajiToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
BukaSlipGajiToolStripMenuItem.Click
Dim
frm3 As New
Form3
frm3.MdiParent = Me
frm3.Show()
End Sub
Private Sub KeluarToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
KeluarToolStripMenuItem.Click
Me.Close()
End Sub
Private Sub HorizontalToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
HorizontalToolStripMenuItem.Click
Me.LayoutMdi(MdiLayout.TileHorizontal)
End Sub
Private Sub VerticalToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
VerticalToolStripMenuItem.Click
Me.LayoutMdi(MdiLayout.TileVertical)
End Sub
Private Sub CascadeToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
CascadeToolStripMenuItem.Click
Me.LayoutMdi(MdiLayout.Cascade)
End Sub
End Class
FORM 2
Public Class Form2
Sub
bersih()
ComboBoxnamapegawai.Text = ""
CheckBox1.Checked = False
CheckBox2.Checked = False
CheckBox3.Checked = False
CheckBox4.Checked = False
CheckBox5.Checked = False
CheckBox6.Checked = False
CheckBox7.Checked = False
CheckBox8.Checked = False
CheckBox9.Checked = False
Txtjumlahanak.Text = ""
Txttunjangananak.Text = ""
Txttunjanganmenikah.Text = ""
Txtbonus.Text = ""
Txtgajipokok.Text = ""
Txttotalgaji.Text = ""
End Sub
Sub
tunjmenikah()
If
CheckBox7.Checked = True Then
Txttunjanganmenikah.Text = 0
ElseIf
CheckBox9.Checked = True Then
Txttunjanganmenikah.Text = 0
ElseIf
CheckBox8.Checked = True Then
Txttunjanganmenikah.Text = 1200000
End If
End Sub
Sub bonusgaji()
If
CheckBox1.Checked = True Then
Txtbonus.Text = 0.75 *
Val(Txtgajipokok.Text)
ElseIf
CheckBox2.Checked = True Then
Txtbonus.Text = 0.65 *
Val(Txtgajipokok.Text)
ElseIf
CheckBox3.Checked = True Then
Txtbonus.Text = 0.55 *
Val(Txtgajipokok.Text)
ElseIf
CheckBox4.Checked = True Then
Txtbonus.Text = 0.5 *
Val(Txtgajipokok.Text)
End If
End Sub
Sub total()
Txttotalgaji.Text =
Val(Txtgajipokok.Text) + Val(Txttunjanganmenikah.Text) +
Val(Txttunjangananak.Text) + Val(Txtbonus.Text)
End Sub
Private Sub CheckBox1_CheckedChanged(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles CheckBox1.CheckedChanged
If
CheckBox1.Checked = True Then
Txtgajipokok.Text = 1000000
End If
End Sub
Private Sub Form2_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Label12.Text = DateAndTime.Now()
Dim
dir_name As String
= Application.StartupPath
If
dir_name.EndsWith("bin\debug") Then dir_name = dir_name.Substring(0, dir_name.Length
- 9)
If Not dir_name.EndsWith("\")
Then dir_name &= "\"
ComboBoxnamapegawai.Text = dir_name
& "Book1.csv"
Dim
all_lines() As String
= System.IO.File.ReadAllLines(ComboBoxnamapegawai.Text)
ComboBoxnamapegawai.DataSource =
all_lines
End Sub
Private Sub CheckBox2_CheckedChanged(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
CheckBox2.CheckedChanged
If
CheckBox2.Checked = True Then
Txtgajipokok.Text = 2000000
End If
End Sub
Private Sub CheckBox3_CheckedChanged(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
CheckBox3.CheckedChanged
If
CheckBox3.Checked = True Then
Txtgajipokok.Text = 3000000
End If
End Sub
Private Sub CheckBox4_CheckedChanged(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
CheckBox4.CheckedChanged
If
CheckBox4.Checked = True Then
Txtgajipokok.Text = 4000000
End If
End Sub
Private Sub CheckBox7_CheckedChanged(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
CheckBox7.CheckedChanged
Call
tunjmenikah()
End Sub
Private Sub CheckBox8_CheckedChanged(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
CheckBox8.CheckedChanged
Call
tunjmenikah()
End Sub
Private Sub Txtjumlahanak_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles
Txtjumlahanak.TextChanged
If
Txtjumlahanak.Text = "" Then
Txttunjangananak.Text = 0
ElseIf Txtjumlahanak.Text = 1 Then
Txttunjangananak.Text = 200000
Else
Txttunjangananak.Text = 400000
End If
End Sub
Private Sub Txtgajipokok_TextChanged(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
Txtgajipokok.TextChanged
Call
bonusgaji()
End Sub
Private Sub Txttunjangananak_TextChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
Txttunjangananak.TextChanged
Call
total()
End Sub
Private Sub Txtbonus_TextChanged(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Txtbonus.TextChanged
Call
total()
End Sub
Private Sub Button1_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Call
bersih()
End Sub
Private Sub Button2_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
On Error GoTo InputError
SaveFileDialog1.Filter = "Text files |*txt|all file |*.*|Document
File|*.csv"
SaveFileDialog1.DefaultExt = "*.txt"
SaveFileDialog1.ShowDialog()
Dim
saveF As New
System.IO.StreamWriter("G:\LAB VB1\uas lab vb
1\lulu.txt")
saveF.WriteLine("Perhitungan Gaji Karyawan")
saveF.WriteLine(Label2.Text & " : " & ComboBoxnamapegawai.Text)
saveF.WriteLine(Label1.Text & " : " & Label12.Text)
If
CheckBox1.Checked = True Then
saveF.WriteLine(Label3.Text & " : " & CheckBox1.Checked)
ElseIf
CheckBox2.Checked = True Then
saveF.WriteLine(Label3.Text & " : " & CheckBox2.Checked)
ElseIf
CheckBox3.Checked = True Then
saveF.WriteLine(Label3.Text & " : " & CheckBox3.Checked)
ElseIf
CheckBox4.Checked = True Then
saveF.WriteLine(Label3.Text & " : " & CheckBox4.Checked)
ElseIf
CheckBox5.Checked = True Then
saveF.WriteLine(Label4.Text & " : " & CheckBox5.Checked)
ElseIf
CheckBox6.Checked = True Then
saveF.WriteLine(Label4.Text & " : " & CheckBox6.Checked)
ElseIf
CheckBox7.Checked = True Then
saveF.WriteLine(Label5.Text & " : " & CheckBox7.Checked)
ElseIf
CheckBox8.Checked = True Then
saveF.WriteLine(Label5.Text & " : " & CheckBox8.Checked)
ElseIf
CheckBox9.Checked = True Then
saveF.WriteLine(Label4.Text & " : " & CheckBox9.Checked)
End If
saveF.WriteLine(Label6.Text & " : " & Txtjumlahanak.Text)
saveF.WriteLine(Label7.Text & " : " & Txtgajipokok.Text)
saveF.WriteLine(Label8.Text & " : " & Txttunjanganmenikah.Text)
saveF.WriteLine(Label9.Text & " : " & Txttunjangananak.Text)
saveF.WriteLine(Label10.Text & " : " & Txtbonus.Text)
saveF.WriteLine(Label11.Text & " : " & Txttotalgaji.Text)
saveF.Close()
Exit Sub
InputError:
MsgBox("LengkapiInput",
, "Informasi")
End Sub
Private Sub Button3_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Me.Close()
End Sub
End Class
FORM 3
Public Class Form3
Private Sub Form3_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
OpenFileDialog1.Filter = "Text Files |*.txt|All files |*.*|Document
File|*.Doc"
OpenFileDialog1.DefaultExt = "*.txt"
OpenFileDialog1.ShowDialog()
TextBox1.Text =
OpenFileDialog1.FileName
Dim
noFile As Integer
noFile = FreeFile()
FileOpen(noFile, TextBox1.Text,
OpenMode.Input)
RichTextBox1.Text = InputString(noFile,
LOF(noFile))
FileClose(noFile)
End Sub
Private Sub Button1_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Me.Close()
End Sub
Private Sub TextBox1_TextChanged(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox1.TextChanged
End Sub
End Class
Sekian aplikasi yang saya buat semoga bermanfaat. Terimakasih