public class Person
{
private string firstName;
public string FirstName
{
get { return firstName; }
set
{
if (string.IsNullOrEmpty(value))
throw new ArgumentNullException("FirstName cannot be null.");
firstName = value;
}
}
private string lastName;
public string LastName
{
get { return lastName; }
set
{
if (string.IsNullOrEmpty(value))
throw new ArgumentNullException("LastName cannot be null.");
lastName = value;
}
}
public int Age { get; set; }
}
Person フィールド (テキスト ボックス) と errorProvider は personBindingSource にバインドされます。
ユーザーがFirstNameを入力しなかった場合、errorProviderがキャッチして表示するように、ダーティイベントを発生させる方法はありますか。現在のところ、タブでフィールドにいくつかの文字を入力し、それらを削除した場合にのみ機能し、エラー プロバイダーが表示されます。
電話しても
personBindingSource.EndEdit();
firstName テキストボックスに入力したことがない場合、起動しません。回避策はありますか?
よろしく
_エリック