Estoy programando un formuario y quiero que cuando alguien presione el boton ok y este evalue que ciertos cuadros estan vacios no siga, ya que le coloco STOP EVENT y no lo toma en cuenta y sigue como si nada y me crea un error en el formulario porque este necesita los valores que el otro no le pudo enviar por haber cuadros vacios...
Aqui presento el codigo del evento del boton:
Public Sub btnOK_Click()
Dim consul As Boolean = False
Dim dat As String
If materia1.Text = "" And materia.Text = "" Then
Message.Error("Por favor Especifique la Materia antes de Continuar")
Stop Event
Else If Not materia1.Text = "" Then
mat = materia1.Text
Else
mat = materia.Text
consul = True
Endif
If profesor1.Text = "" And profesor.Text = "" Then
Message.Error("Por favor Especifique el Profesor que Imparte la Materia antes de Continuar")
Stop Event
Else If Not profesor1.Text = "" Then
prof = profesor1.Text
Else
prof = profesor.Text
consul = True
Endif
If seccion1.Text = "" And seccion.Text = "" Then
Message.Error("Por favor Especifique la Sección antes de Continuar")
Stop Event
Else If Not seccion1.Text = "" Then
secc = seccion1.Text
Else
secc = seccion.Text
consul = True
Endif
If consul Then
conexclass.tablapet = "materia"
dat = Subst$("'&1', '&2', '&3'", mat, prof, secc)
conexclass.insertardatos("nommat, nomprof, seccion", dat)
Endif
Print mat
Print prof
Print secc
Notas.show
Me.Close(True)
End
Dim consul As Boolean = False
Dim dat As String
If materia1.Text = "" And materia.Text = "" Then
Message.Error("Por favor Especifique la Materia antes de Continuar")
Stop Event
Else If Not materia1.Text = "" Then
mat = materia1.Text
Else
mat = materia.Text
consul = True
Endif
If profesor1.Text = "" And profesor.Text = "" Then
Message.Error("Por favor Especifique el Profesor que Imparte la Materia antes de Continuar")
Stop Event
Else If Not profesor1.Text = "" Then
prof = profesor1.Text
Else
prof = profesor.Text
consul = True
Endif
If seccion1.Text = "" And seccion.Text = "" Then
Message.Error("Por favor Especifique la Sección antes de Continuar")
Stop Event
Else If Not seccion1.Text = "" Then
secc = seccion1.Text
Else
secc = seccion.Text
consul = True
Endif
If consul Then
conexclass.tablapet = "materia"
dat = Subst$("'&1', '&2', '&3'", mat, prof, secc)
conexclass.insertardatos("nommat, nomprof, seccion", dat)
Endif
Print mat
Print prof
Print secc
Notas.show
Me.Close(True)
End