I use an errorprovider on a radform to show input errors to the user. I can use it with a radtextbox when the validating event is triggered like so:
Where txtBox is a RadtextBox.
2 problems I encounter when using a CommandBarTextBox:
first: raising the validating event
second: using the SetError method of the errorprovider to link it to a CommandBarTextBox.
I tried adding the validating event in the form_load event:
But vs2010 throws me a compile error:
Argument not specified for parameter 'sender' of 'Private Sub txtPIN_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs)'.
Argument not specified for parameter 'e' of 'Private Sub txtPIN_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs)'.
Not being able to use the errorprovider, a work around using the commandbartextbox border forecolor is an acceptable solution. But not being able to use the validating event of the CommandBarTextBox, I can't work around that one...
errProvider.SetError(txtBox, errMsg)
errProvider.Icon = Icon.FromHandle(My.Resources.input_error.GetHicon())
errProvider.SetIconAlignment(txtBox, ErrorIconAlignment.MiddleLeft)
2 problems I encounter when using a CommandBarTextBox:
first: raising the validating event
second: using the SetError method of the errorprovider to link it to a CommandBarTextBox.
I tried adding the validating event in the form_load event:
AddHandler
txtPIN.TextBoxElement.TextBoxItem.Validating, txtPIN_validating()
Private
Sub
txtPIN_Validating(
ByVal
sender
As
Object
,
ByVal
e
As
System.ComponentModel.CancelEventArgs)
If
HuidigeAccount.Instance.Gebruikers.Count > 0
Then
FormHelper.RequiredTextBox(txtPIN.TextBoxElement, _errProvider, _errProviderMsg,
"Er is een pincode vereist om op te slaan"
)
End
If
End
Sub
Argument not specified for parameter 'sender' of 'Private Sub txtPIN_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs)'.
Argument not specified for parameter 'e' of 'Private Sub txtPIN_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs)'.
Not being able to use the errorprovider, a work around using the commandbartextbox border forecolor is an acceptable solution. But not being able to use the validating event of the CommandBarTextBox, I can't work around that one...