Hi,
Could you please suggest me something?
This code works witout exceptions:
public partial class Form1 : Form
{
private object _source = null;
public object Source
{
get { return _source; }
set { _source = value; }
}
private object _target;
public object Target
{
get { return _target; }
set { _target = value; }
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
DataBindings.Add("Target", this, "Source");
}
}
This code raises an exception at OnLoad ("Cannot format the value to the desired type"):
public partial class Form1 : Form
{
private DataTable _source = null;
public DataTable Source
{
get { return _source; }
set { _source = value; }
}
private DataTable _target;
public DataTable Target
{
get { return _target; }
set { _target = value; }
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
DataBindings.Add("Target", this, "Source");
}
}
The only defference here is the data type of properties.
I have to make it work properly with null values and DataTable types.
Do you have any ideas?
Thanks!
-- dmitry
Dmitry Nogin - 27 Sep 2007 17:06 GMT
I encountered the same problem when data type is MarshalByValueComponent.
Hi,
Could you please suggest me something?
This code works witout exceptions:
public partial class Form1 : Form
{
private object _source = null;
public object Source
{
get { return _source; }
set { _source = value; }
}
private object _target;
public object Target
{
get { return _target; }
set { _target = value; }
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
DataBindings.Add("Target", this, "Source");
}
}
This code raises an exception at OnLoad ("Cannot format the value to the desired type"):
public partial class Form1 : Form
{
private DataTable _source = null;
public DataTable Source
{
get { return _source; }
set { _source = value; }
}
private DataTable _target;
public DataTable Target
{
get { return _target; }
set { _target = value; }
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
DataBindings.Add("Target", this, "Source");
}
}
The only defference here is the data type of properties.
I have to make it work properly with null values and DataTable types.
Do you have any ideas?
Thanks!
-- dmitry