when I binding a string with a textbox
Code:
tbOT.DataBindings.Add(new Binding("Text",pedido,"OT"));
and this string is null ocurrs an error at runtime: 'System.OutOfMemoryException'
searching in the web, I found a "betterbinding" function that resolves that problem:
Code:
public class BetterBinding : Binding
{
public BetterBinding(string propertyName, object dataSource, string dataMember) : base(propertyName, dataSource, dataMember)
{
}
protected override void OnParse(ConvertEventArgs e)
{
TypeConverter converter = TypeDescriptor.GetConverter(e.DesiredType);
if (converter != null && converter.CanConvertFrom(e.Value.GetType()))
{
e.Value = converter.ConvertFrom(e.Value);
}
else
{
base.OnParse(e);
}
}
}
....
....
tbOT.DataBindings.Add(new BetterBinding("Text",pedido,"OT"));
I think that changing "System.String" by "NullableString" the problem is solved or not???.