Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Data Binding / December 2004

Tip: Looking for answers? Try searching our database.

Binding textboxs to dataRow with null fields

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ClydeL - 01 Dec 2004 05:45 GMT
I have a number of text boxes bound to fields in a datarow selected from a
dataset.  Everything works until one of the fields is null.
Binding a bit field to a checkbox doesn't have this problem.
Is this supposed to work with null fields?
Colin R. R. Johnson - 14 Dec 2004 01:49 GMT
ClydeL,

It sounds like what you need is to add an event handler for the
Binding.Format event. By using an event handler for format you can
replace the NULL with whatever text you want, e.g. "N/A", "(null)", "No
Data" etc.

This also ensures you don't get an error because the binding manager is
trying to set a string property to null.

The reason you don't have a problem with a bit field is because the bit
can either be set to true or false. If the database schema allows for a
null value in the bit field the three state checkbox has a state for null.

There's an example in the VS documentation.

> I have a number of text boxes bound to fields in a datarow selected from a
> dataset.  Everything works until one of the fields is null.
> Binding a bit field to a checkbox doesn't have this problem.
> Is this supposed to work with null fields?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.