Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6652753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:10:49+00:00 2026-05-26T01:10:49+00:00

I am displaying data from SQL in a datagridview by using a SqlDataAdapter. (This

  • 0

I am displaying data from SQL in a datagridview by using a SqlDataAdapter. (This is a C# Winforms app but this question could just as easily apply to VB.) Some of the columns are a nullable bool.

Currently the datagridview uses a standard CheckBox column, which uses an empty checkbox both for null and false, and a checked checkbox for true.

I would like to create a column that displays no checkbox at all for null values.

What’s the best way to approach this problem? I am wondering if I should create a new control that inherits from the DataGridView and go from there.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:10:49+00:00Added an answer on May 26, 2026 at 1:10 am

    Here is a solution that I’ve employed and is currently working:

    ((DataGridViewCheckBoxColumn)dgvDisplayData.Columns["field_name"]).ThreeState = true;
    

    This is done after the data binding and assuming that the sql field “field_name” is a nullable boolean. Resharper isn’t especially happy with this format, providing a “Possible System.NullReferenceException” warning.

    I’d still be interested in alternative/better suggestions.

    Edit:

    I’ve changed this as follows to avoid potential null value exceptions:

    DataGridViewCheckBoxColumn chkCol =
        (DataGridViewCheckBoxColumn)dgvDisplayData.Columns["field_name"];
    if (chkCol != null) chkCol.ThreeState = true;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WCF web-service and a Silverlight app displaying data from that service.
i'm new to asp.net mvc. I'm displaying data from a linq to sql query
When im using Select statement for displaying data from Mysql Db. Im getting Duplicate
I am pulling some details from sql server and displaying in data-grid. I would
I have a gridview that is displaying data from a database using LINQ to
So I have a PHP backend that pulls some data from SQL, let's just
I'm having a problem displaying data from a function to text box within a
I am displaying a scrolled data table in a web page. This table has
I'm a bit confused about displaying data from a MySQL database. I would like
I have a very simple page that is displaying canned data. I experienced this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.