> I create a class
> I create a form with a bindingsource object with datasource a instance of a
[quoted text clipped - 7 lines]
> thanks in advance
> FLAVIO
Hi Flavio,
BindingSource.DataError is triggered only on currency related errors. Furthermore, if the offending piece of code is triggered by a windows event, Windows might silently eat the error as well.
If you post a code sample demonstrating the problem I might be able to provide a solution.

Signature
Happy coding!
Morten Wennevik [C# MVP]
Flavio MIANO - 18 Sep 2007 01:43 GMT
Public Class Paziente
Private _Sesso As String
Public Property Sesso() As String
Get
Return _Sesso
End Get
Set(ByVal value As String)
If value IsNot Nothing Then
value = Char.ToUpper(value)
If value = "M" Or value = "F" Then
_Sesso = value
Else
throw new exception("Error sex must be M or F")
End If
Else
_Sesso = Nothing
End If
End Set
End Property
End Class
when i set Sesso in the form if i set some different from M or F
occur an error
and the focus remain in the textbox
how to capture the error message ex.message to display in the user interface
?
Thanks
FLAVIO
end class
>> I create a class
>> I create a form with a bindingsource object with datasource a instance of
[quoted text clipped - 17 lines]
> If you post a code sample demonstrating the problem I might be able to
> provide a solution.
Morten Wennevik [C# MVP] - 18 Sep 2007 17:13 GMT
Ok, now I understand, and no, Exceptions like that will be eaten, but there is an alternate way. Using IDataError and possibly INotifyPropertyChanged you can display an error icon next to the control with an illegal value. Instead of throwing an exception when you detect an illegal value you set an error property with the error text. This text will then be displayed if you hold your mouse over the error icon.
Setting this up can be a bit tricky, but I think this article might provide some ideas. I know I have some code samples somewhere demonstrating this as well. I'll see what I can dig up.
http://www.codeproject.com/csharp/DelegateBusinessObjects.asp
> Public Class Paziente
>
[quoted text clipped - 55 lines]
>> Happy coding!
>> Morten Wennevik [C# MVP]

Signature
Happy coding!
Morten Wennevik [C# MVP]