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 / Languages / C# / August 2006

Tip: Looking for answers? Try searching our database.

DataGridView DataGridViewCheckBoxCell throws NullReferenceException

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Karen Hill - 30 Aug 2006 20:27 GMT
I have a datagridview control on a form with a few of the columns being
DataGridViewCheckBox.  Whenever I click on the checkbox to create a new
record I get a NullReference Exception thrown even though I check for
NULL using System.Convert.IsDbNull function.

What gives?

I'm catching the NullReferenceException, although I know it is not
correct to do for normal program flow.   What is the solution?
Gino - 31 Aug 2006 01:14 GMT
Without seeing some code I can only generalize.

NullRefference errors indicate that a method or property is being accessed
without its class being instantiated.

DBnull errors indicate that a Null is being returned from the DataBase and
its type is not recognized by the compiler.

In that case you can look into overriding, and handle it inside.

>I have a datagridview control on a form with a few of the columns being
> DataGridViewCheckBox.  Whenever I click on the checkbox to create a new
[quoted text clipped - 5 lines]
> I'm catching the NullReferenceException, although I know it is not
> correct to do for normal program flow.   What is the solution?
Rick Shaw - 31 Aug 2006 23:14 GMT
How about setting the threestate property if the checkbox to true.  This
will allow the checkbox to accept anything other than true or false.

Try that out.

Rick..

> I have a datagridview control on a form with a few of the columns being
> DataGridViewCheckBox.  Whenever I click on the checkbox to create a new
[quoted text clipped - 5 lines]
> I'm catching the NullReferenceException, although I know it is not
> correct to do for normal program flow.   What is the solution?

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.