Hello good afternoon everyone, along with hello I wanted to ask you, someone has used the errorprovider in the validation of a combobox?
I have a button that in the click event asks to validate that a value is entered in a textbox and that an item of the combobox is selected, in my botin I have this code:
If Me.ValidateChildren And txtNombre.Text <> String.Empty And cmbDepartamento.SelectedIndex.Equals(-1) Then
'ACCIONES A SEGUIR PORQUE SE PASO LA VALIDACION
MsgBox("PASAMOS LAS VALIDACIONES")
Else
'FALLO LA VALIDACION DE LOS CONTROLES
MsgBox("SE PRESENTARON ERRORES, FAVOR CORRIGALOS")
End If
I am using the validating method of the combobox to validate, in which I use this code:
If (cmbDepartamento.SelectedIndex.Equals(0)) Then
Me.erpSoporte.SetError(sender, "")
Else
Me.erpSoporte.SetError(sender, "Seleccione Departamento")
End If
but it throws me every time I have to select a value, that is, it recognizes that it does not select anything, but when I select it, it keeps throwing me the same error.
Greetings to everyone and thank you for your time.