Public Class LoanDetail
Dim EditRecord As Boolean
'This Code close the active window when user press the esc key
Private Sub LoanDetail_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.Escape Then Close()
End Sub
'Retrieve data during load
Private Sub LoanDetail_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'PayrollDataSet.LoanType' table. You can move, or remove it, as needed.
If Trim(txtCode.Text) <> "" Then
Me.LoanTypeTableAdapter.FillBy(Me.PayrollDataSet.LoanType, txtCode.Text)
End If
txtCode.MaxLength = PayrollDataSet.Tables("LoanType").Columns.Item("Code").MaxLength
txtDescription.MaxLength = PayrollDataSet.Tables("LoanType").Columns.Item("Description").MaxLength
End Sub
'--- New Entry
Private Sub tsNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsNew.Click
Try
EditRecord = True
Me.LoanTypeBindingSource.AddNew()
tsSave.Enabled = True
tsDelete.Enabled = False
PrintToWindowToolStripMenuItem.Enabled = False
PrintToPrinterToolStripMenuItem.Enabled = False
Catch ex As Exception
MsgBox(Err.Number & " " & Err.Description)
End Try
End Sub
'Save record
Private Sub tsSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsSave.Click
'Check if New Record and Date already exist...
Try
Me.LoanTypeBindingSource.EndEdit()
Me.LoanTypeTableAdapter.Update(Me.PayrollDataSet.LoanType)
If EditRecord = True Then
MsgBox("Record successfully Added.", MsgBoxStyle.Information)
Else
MsgBox("Record successfully updated.", MsgBoxStyle.Information)
End If
EditRecord = False
HasChanges = True
Close()
Catch ex As Exception
MsgBox(Err.Number & " " & Err.Description)
End Try
End Sub
'Delete Record
Private Sub tsDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsDelete.Click
Dim Result As DialogResult
Result = MessageBox.Show("Are you sure you want to delete this record?", "Delete Record" _
, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Asterisk)
If Result = Windows.Forms.DialogResult.No Then
Exit Sub
ElseIf Result = Windows.Forms.DialogResult.Cancel Then
Close()
Exit Sub
End If
Try
Me.LoanTypeBindingSource.RemoveCurrent()
Me.LoanTypeBindingSource.EndEdit()
Me.LoanTypeTableAdapter.Update(Me.PayrollDataSet.LoanType)
MsgBox("Record successfully deleted.", MsgBoxStyle.Information)
HasChanges = True
Close()
Catch ex As Exception
MsgBox(Err.Number & " " & Err.Description)
End Try
End Sub
'Close Window
Private Sub ToolStripButton5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton5.Click
Close()
End Sub
'Send tab key when user hit the enter key in the textbox or combox
Private Sub txtCode_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtCode.KeyDown
If e.KeyCode = Keys.Enter Then SendKeys.Send("{TAB}")
End Sub
End Class
Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com
atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :