471,349 Members | 1,810 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,349 software developers and data experts.

Data binding and Null Values

When you bind a text box to a field that contains null values the text box
displays an empty string. Great!

My Database field is an integer and I want an empty text box to represent a
NULL value. However the EndEdit event on the datarow returns the error The
input string was in an incorrect format

I have failed to find a way to either trap the empty string in the
rowchanging event and turn it into DBNULL or to programatically manipulate
the value in the field to DBNull.Value when a keypress results in no thext
left in the Textbox.

How? Please, can I comunicate a NULL value back to the datarow with a
databound text box?

Regards

Ben Reese
Jul 25 '05 #1
1 2304
Handle the Parse event of the Binding on your textbox. In it, you can return
dbnull.value if the textbox contains an empty string.

"Ben Reese" <Be******@discussions.microsoft.com> wrote in message
news:F1**********************************@microsof t.com...
When you bind a text box to a field that contains null values the text box
displays an empty string. Great!

My Database field is an integer and I want an empty text box to represent
a
NULL value. However the EndEdit event on the datarow returns the error The
input string was in an incorrect format

I have failed to find a way to either trap the empty string in the
rowchanging event and turn it into DBNULL or to programatically manipulate
the value in the field to DBNull.Value when a keypress results in no thext
left in the Textbox.

How? Please, can I comunicate a NULL value back to the datarow with a
databound text box?

Regards

Ben Reese

Jul 25 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by pmud | last post: by
reply views Thread by Wesman | last post: by
reply views Thread by Wesman | last post: by
reply views Thread by NicK chlam via DotNetMonster.com | last post: by
1 post views Thread by Ben Reese | last post: by
3 posts views Thread by sham | last post: by
3 posts views Thread by Max | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.