Check for Changes

To check for changes on the page before closing the form:

Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click

        Dim Result As String = ""
        If DsUnits.HasChanges() Then

            Result = MsgBox(EstimatorParent.SAVEANDCLOSE, MsgBoxStyle.YesNoCancel, EstimatorParent.CHANGES)

            If Result = MsgBoxResult.Yes Then

                UnitsBindingNavigatorSaveItem_Click(Me, e)

            ElseIf Result = MsgBoxResult.No Then

                Me.Close()
                Exit Sub

            ElseIf Result = MsgBoxResult.Cancel Then

                Exit Sub

            End If

        End If
        Me.Close()

    End Sub