Binding INTEGER and use of NULL

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I bind a textbox to a field in the database through CurrencyManager. Everything works find exept one thing: I cannot type Null, blank, nothing in the textfield. The property in the database allows NULL but I cannot type blank in the textbox. Whatever I type that isn't numeric is changed then I leave the textbox

There must be an easy way to solve this - but what?

/Raymond
 
Hi Raymond,

You might use Binding.Parse event. Example:
textBox1.DataBindings[0].Parse += new ConvertEventHandler(Form1_Parse);

private void Form1_Parse(object sender, ConvertEventArgs e)

{

if (e.Value.ToString() == string.Empty)

e.Value = DBNull.Value;

}


--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

Raymond said:
Hi.

I bind a textbox to a field in the database through CurrencyManager.
Everything works find exept one thing: I cannot type Null, blank, nothing in
the textfield. The property in the database allows NULL but I cannot type
blank in the textbox. Whatever I type that isn't numeric is changed then I
leave the textbox.
 
Back
Top