开发者

Returning a DBNull for a bound MaskedTextBox whenever type validation fails?

I have a MaskedTextBox control with the mask "00/00/0000", the PromptChar "_" and the ValidatingType of DateTime, bound to a DateTime column in a database that can also accept null values.

I'd lik开发者_如何学编程e the user to have to enter either a valid date, or leave it blank (i.e. "__/__/____") for a DBNull.

By using the TypeValidationCompleted event I can determine whether a valid date was entered but I do not know how to set the value to a DBNull whenever no date, or an invalid one, is specified.

How can I get a DBNull value from the MaskedTextBox whenever validation fails?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜