Re: Focus Stuck on TextBox
- From: Pavel Minaev <int19h@xxxxxxxxx>
- Date: Wed, 16 Jul 2008 23:56:40 -0700 (PDT)
On Jul 16, 6:58 pm, "jehugalea...@xxxxxxxxx" <jehugalea...@xxxxxxxxx>
wrote:
Hello:
When we have a text box that is bound to an int?, the text box will
not allow the user to leave the control until it has a valid integer
in it. This is actually very bad. If the user wants to remove the
value, they can't anymore. They can't even leave the form! They are
being forced to enter 0 or some other bogus value.
The weird thing is that it doesn't take affect until they set a value
and lose focus on the control.
Is there some way of shutting this off? I'm assuming it is some sort
of funky validation.
If you want to map empty string input by the user to null value in the
int?, just set the DataSourceNullValue property of the Binding to
"null", and NullValue property of the binding to empty string. You
can't do it from the form designer, so you'll have to write some code:
textBox1.DataBindings["Text"].DataSourceNullValue = null;
textBox1.DataBindings["Text"].NullValue = "";
.
- Follow-Ups:
- Re: Focus Stuck on TextBox
- From: jehugaleahsa@xxxxxxxxx
- Re: Focus Stuck on TextBox
- References:
- Focus Stuck on TextBox
- From: jehugaleahsa@xxxxxxxxx
- Focus Stuck on TextBox
- Prev by Date: Re: Passing struct of virtual functions
- Next by Date: Re: Linq. Why do I get this error?
- Previous by thread: Re: Focus Stuck on TextBox
- Next by thread: Re: Focus Stuck on TextBox
- Index(es):
Relevant Pages
|