DataGridView DataGridViewCheckBoxCell throws NullReferenceException

  • Thread starter Thread starter Karen Hill
  • Start date Start date
K

Karen Hill

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?
 
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.
 
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..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top