110 – Delete Statement Using Visual Basic Application for Managing Payroll System Module

0
174

This tutorial about Delete Statement Using Visual Basic Application for managing payroll system module. As database practice, it is important that all records are intact and can be recovered for query purposes at all times. But for the purpose of academic requirement and for testing our application for the delete statement, we will be learning in this lesson how it will be processed and worked.

The image below shows 3 steps on how to delete a particular information in the database.

First, we go to our frmListofEmployee form and add the code below for our DataGridView cell click event.

  1. Private Sub dgvListofEmployee_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvListofEmployee.CellClick
  2.  
  3. EmployeeIDno = dgvListofEmployee.CurrentRow.Cells(0).Value
  4.  
  5. End Sub

Here, we assign a value to our EmployeeIDno variable of the selected employee to be deleted. Make sure you add the variable in our public module. See code below.

  1. Public EmployeeIDno As Integer

When the user click the delete button after selecting a particular employee, message box will appear and ask user to confirm. And if the user decided to delete that information and click Yes, the Delete statement will be executed otherwise cancelled.

  1. Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
  2. Dim Result As DialogResult
  3.  
  4. Result = MessageBox.Show("Are you sure you want to remove this Account?", "Remove Account", MessageBoxButtons.YesNo, MessageBoxIcon.Information)
  5.  
  6. If Result = Windows.Forms.DialogResult.Yes Then
  7.  
  8. DeleteInfo("delete from `tblemployee` where `EMPLOYEEID` =" & EmployeeIDno & "")
  9. frmListofEmployee_Load(sender, e)
  10.  
  11. End If
  12. End Sub

We have acquired now the basic skills in managing our employee information. This would also be the prerequisite technique on all the management information as you go far with our tutorials.

If you have any questions and suggestion about  Delete Statement Using Visual Basic Application, Please feel free to contact me at our contact page.

Previous Topic: 109 – Update Statement Using Visual Basic Application for Managing Payroll System Module

 

Facebook Comments
(Visited 186 times, 1 visits today)

LEAVE A REPLY

Please enter your comment!
Please enter your name here