Chamuanza Posted April 26, 2009 at 09:46 AM Report #259124 Posted April 26, 2009 at 09:46 AM 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
Chamuanza Posted April 26, 2009 at 08:35 PM Author Report #259226 Posted April 26, 2009 at 08:35 PM 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
jpaulino Posted April 26, 2009 at 11:45 PM Report #259259 Posted April 26, 2009 at 11:45 PM Uma boa solução é uma solução que funciona 👍 Não testei, mas também não me parece mal.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now