473,405 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 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 2410
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: pmud | last post by:
Hi, I need to display columns in a data grid based on 7 different queries. Now I have 32 questions: 1. Is it possble to have 1 single data adapter with 7 queries & 1 data set or do I need to...
0
by: Wesman | last post by:
Why does the following code not work (displays the correct values in the second textbox). if i chane the OnFocusChange method to the following it will work: private void OnFocusChange(object...
0
by: Wesman | last post by:
Why does the following code not work (displays the correct values in the second textbox). if i chane the OnFocusChange method to the following it will work: private void OnFocusChange(object...
0
by: NicK chlam via DotNetMonster.com | last post by:
this is the error i get System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement. at System.Data.Common.DbDataAdapter.Update(DataRow dataRows, DataTableMapping tableMapping) at...
1
by: msmcg | last post by:
I need to format the data in some textboxes using the Binding method with custom Currency and ShortDate format and parse handlers. Here is the code that I am using. I call it on the form load...
1
by: Ben Reese | last post by:
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...
3
by: sham | last post by:
Hi to all, I have an object that has a property numberOfFilesDeleted which is an integer. I want to bind a label to it so that when the value changes, the label gets updated on the screen. I...
3
by: Max | last post by:
Hello, I made a windows form with a combo box and 4 text boxes. All 5 objects should get their data from a data set which is populated in the form load method. The combo box has item ids. When...
0
by: Ron | last post by:
Hi, I have a Windows form which contains roughly 100 controls on multiple tabs. I am data binding to a List<collection at runtime: CompanyMasterData company =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.