When you bind property Value an exception is thrown:
An exception of the type "System.ArgumentException" appeared in System.Windows.Forms.dll, but was not processed in user code
For more information: For a composite DataBinding, the IList or IListSource can serve as the data source.
Form
public partial class MainForm : Form, IPresenter<MainPresenter>
{
private MainPresenter _presenter;
public MainForm()
{
InitializeComponent();
_presenter = new MainPresenter() { Current = this };
numericUpDown1.DataBindings.Add(new Binding("Value", _presenter, nameof(_presenter.YearOfIssue), false, DataSourceUpdateMode.OnPropertyChanged));
}
}
Presetner
public class MainPresenter : PresenterBase, IView<MainForm>
{
private decimal _yearOfIssue;
private MainForm _form;
public decimal YearOfIssue
{
get
{
return _yearOfIssue;
}
set
{
_yearOfIssue = value;
OnChanged("YearOfIssue");
}
}
}
Question
How to correctly bind the property "Value" in Control NumericUpDown?