PC Review


Reply
Thread Tools Rate Thread

DataGridView DataGridViewCheckBoxCell throws NullReferenceException

 
 
Karen Hill
Guest
Posts: n/a
 
      30th Aug 2006
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?

 
Reply With Quote
 
 
 
 
Gino
Guest
Posts: n/a
 
      31st Aug 2006
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.





"Karen Hill" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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?
>



 
Reply With Quote
 
Rick Shaw
Guest
Posts: n/a
 
      31st Aug 2006
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..

"Karen Hill" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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?
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to set DataGridViewCheckboxCell to Checked in DataGridView in a TabControl Karl Microsoft Dot NET 1 10th Aug 2007 04:24 PM
NullReferenceException handler throws NullReferenceException! Zytan Microsoft C# .NET 7 19th Mar 2007 09:27 PM
NullReferenceException when binding DataGridView to datasource nospam@meatonconsulting.com Microsoft VB .NET 2 1st Mar 2007 01:23 PM
DeriveParameters throws NullReferenceException rockdale Microsoft Dot NET Compact Framework 0 23rd Aug 2006 07:50 PM
DataView.get_Item throws a NullReferenceException Jonathan Allen Microsoft C# .NET 3 27th Jul 2005 06:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:46 AM.