Jump to content

Recommended Posts

Posted

Oi pessoal

Tenho este código para cancelar um novo registo, mas não funciona pois mesmo assim a nova linha na Grid aparece na mesma

 Private Sub BindingNavigatorAddNewItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorAddNewItem.Click


        Dim msg As String
        Dim title As String
        Dim style As MsgBoxStyle
        Dim response As MsgBoxResult
        msg = "Vai ser Adicionado um Novo Registo - Quer continuar?"   ' Define message.
        style = MsgBoxStyle.DefaultButton2 Or _
           MsgBoxStyle.Critical Or MsgBoxStyle.YesNo
        title = "Apagar Registo"   ' Define title.
        ' Display message.
        response = MsgBox(msg, style, title)


        If response = MsgBoxResult.No Then

            Exit Sub
        Else
            DataDateTimePicker.Focus()

        End If


    End Sub

Obrigado

Posted

Oi pessoal quanto a esta situação penso ter resolvido a quastão,pelo menos por agora

Foi assim:

No envento Private Sub FamiliaComboBox_LostFocus coloquei o codigo que envio - foi a melhor solução ?

Private Sub FamiliaComboBox_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles FamiliaComboBox.LostFocus

        Dim msg As String
        Dim title As String
        Dim style As MsgBoxStyle
        Dim resposta As MsgBoxResult
        msg = "Salvar Registo - Quer continuar?"   ' Define message.
        style = MsgBoxStyle.DefaultButton2 Or _
           MsgBoxStyle.Critical Or MsgBoxStyle.YesNo
        title = "Salvar Registo"   ' Define title.
        ' Display message.
        resposta = MsgBox(msg, style, title)


        If resposta = MsgBoxResult.No Then

            Me.PrincipalBindingNavigator.BindingSource.RemoveCurrent()
            Exit Sub
        Else
            'Aplica o save quando sai da cx. texto
            PrincipalBindingNavigatorSaveItem.PerformClick()

        End If

    End Sub

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.