While trying to solve a two-way data binding problem in here, I found that the following does not throw an invalid member exception, which if I recall correctly, it should. MSDN also documents the existence of this Exception here, but why doesn’t it throw?
namespace EnumDataBinding
{
public partial class Form1 : Form
{
public Form1()
{
ComboBox box = new ComboBox();
// EXPECT: DataMember not found exception
// RESULT: Exception not thrown!
box.DataBindings.Add("Text", new Entity(), "asdhjgfjhrt");
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
}
}
public class Entity
{
public string MyProperty { get; set; }
}
}
Because you haven’t add
ComboBoxinto container (Form).