Problemas con MessageBox
Publicado por apacheco (98 intervenciones) el 11/03/2013 12:26:57
Estoy migrando un aplicacion de Vb6 a VS2008, y en este ultimo el siguiente proceso de mete en un bucle SIN EJECUTAR NINGUNA DE LAS OPCIONES TANTO SI CONTESTO SI COMO SI CONTESTO NO.
Os paso el codigo, por si alguien me puede explicar el porque:
Private Sub cmbNomCli_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbNomCli.GotFocus
Ver_Pendiente_De_Grabar()
codcli = False
cmbCodCli.Tag = "*"
cmbCodCli.SelectedIndex = -1
cmbCodCli.Tag = String.Empty
cmbNomCli.Tag = "*"
cmbNomCli.SelectedIndex = -1
cmbNomCli.Tag = String.Empty
btTodos.Visible = True
Habilitar_Campos()
Limpiar_Campos()
Inhabilitar_Campos()
End Sub
Private Sub Ver_Pendiente_De_Grabar()
If dgvArticulos.RowCount > 0 Then
If MessageBox.Show("EXISTE UNA RECOGIDA PENDIENTE DE" & vbCrLf & vbCrLf & _
"GRABAR. SI CONTINÚA SE PERDERÁ" & vbCrLf & vbCrLf & _
" ¿DESEA GRABARLA (Sí/No)?", _
"PROCESO DE RECOGIDAS", _
MessageBoxButtons.YesNo, _
MessageBoxIcon.Warning, _
MessageBoxDefaultButton.Button1) = Windows.Forms.DialogResult.Yes Then
' Si respondo SI
AddHandler btGrabar.Click, AddressOf btGrabar_Click
Else
' Si respondo NO
dgvArticulos.Rows.Clear()
End If
End If
End Sub
Cuando contesto al MessageBox (ya sea si o no) no se ejecutan ni al AddHandler .... si he contestado si, no dgvArticulo.Rows.Clear si contesto no, SIMPLEMENTE EL CONTROL PASA DE NUEVO A CmbNomCli_GotFocus
Un saludo ..... y muchas gracias
Os paso el codigo, por si alguien me puede explicar el porque:
Private Sub cmbNomCli_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbNomCli.GotFocus
Ver_Pendiente_De_Grabar()
codcli = False
cmbCodCli.Tag = "*"
cmbCodCli.SelectedIndex = -1
cmbCodCli.Tag = String.Empty
cmbNomCli.Tag = "*"
cmbNomCli.SelectedIndex = -1
cmbNomCli.Tag = String.Empty
btTodos.Visible = True
Habilitar_Campos()
Limpiar_Campos()
Inhabilitar_Campos()
End Sub
Private Sub Ver_Pendiente_De_Grabar()
If dgvArticulos.RowCount > 0 Then
If MessageBox.Show("EXISTE UNA RECOGIDA PENDIENTE DE" & vbCrLf & vbCrLf & _
"GRABAR. SI CONTINÚA SE PERDERÁ" & vbCrLf & vbCrLf & _
" ¿DESEA GRABARLA (Sí/No)?", _
"PROCESO DE RECOGIDAS", _
MessageBoxButtons.YesNo, _
MessageBoxIcon.Warning, _
MessageBoxDefaultButton.Button1) = Windows.Forms.DialogResult.Yes Then
' Si respondo SI
AddHandler btGrabar.Click, AddressOf btGrabar_Click
Else
' Si respondo NO
dgvArticulos.Rows.Clear()
End If
End If
End Sub
Cuando contesto al MessageBox (ya sea si o no) no se ejecutan ni al AddHandler .... si he contestado si, no dgvArticulo.Rows.Clear si contesto no, SIMPLEMENTE EL CONTROL PASA DE NUEVO A CmbNomCli_GotFocus
Un saludo ..... y muchas gracias
Valora esta pregunta


0