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

0
439

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.

[vbnet]

Private Sub dgvListofEmployee_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvListofEmployee.CellClick

EmployeeIDno = dgvListofEmployee.CurrentRow.Cells(0).Value

End Sub

[/vbnet]

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.

[vbnet]

Public EmployeeIDno As Integer

[/vbnet]

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.

[vbnet]

Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
Dim Result As DialogResult

Result = MessageBox.Show(“Are you sure you want to remove this Account?”, “Remove Account”, MessageBoxButtons.YesNo, MessageBoxIcon.Information)

If Result = Windows.Forms.DialogResult.Yes Then

DeleteInfo(“delete from tblemployee where EMPLOYEEID =” & EmployeeIDno & “”)
frmListofEmployee_Load(sender, e)

End If
End Sub

[/vbnet]

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

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.