Public Class frmDesignation
    Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click
        Me.Close()
    End Sub

    Private Sub btnSubmit_Click(sender As Object, e As EventArgs) Handles btnSubmit.Click

    End Sub

    Private Sub frmDesignation_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        LoadData()
    End Sub

    Private Sub LoadData()
        FillDataGrid("SELECT DESG_ID, DesignationName FROM Designation", DataGridView1)
    End Sub

    Private Sub DataGridView1_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
        If e.ColumnIndex = 0 Then
            If MsgBox("Are you sure to edit: " & DataGridView1.CurrentRow.Cells(3).Value, MsgBoxStyle.YesNo + MsgBoxStyle.Exclamation, "Confirm..") = MsgBoxResult.Yes Then
                txtDESG_ID.Text = DataGridView1.CurrentRow.Cells(2).Value
                txtDesignation.Text = DataGridView1.CurrentRow.Cells(3).Value
                btnSubmit.Text = "UPDATE"
            End If
        ElseIf e.ColumnIndex = 1 Then
            If MsgBox("Are you sure to delete: " & DataGridView1.CurrentRow.Cells(3).Value, MsgBoxStyle.YesNo + MsgBoxStyle.Exclamation, "Confirm..") = MsgBoxResult.Yes Then
                ExecuteSQLQuery("DELETE FROM  Designation  WHERE DESG_ID=" & num_fltr(DataGridView1.CurrentRow.Cells(2).Value) & " ")
                LoadData()
                MsgBox("Data has been deleted successfully.", MsgBoxStyle.Information, "Information")
            End If
        End If
    End Sub
End Class