How do show a boolean value as a checkbox in my datagrid after formatting each column and not "true" or "false" strings?

Posted on 2006-04-28
Last Modified: 2010-04-23
I have a DataGridTableStyle assigned to my DataGrid. Each column is individually formatted from within the DataGridColumnStyle Collection Editor.

Some of the columns are boolean values, but at runtime, are displayed as "True" or "False" strings.
How do I make it display a checkbox with the respective value instead?
Question by:IvanHowarth
    LVL 35

    Expert Comment

    make sure a DataGrid column is set up as a checkbox and not a regular column

    Author Comment

    I can't find where to do it on Visual Studio 2003. Is there a property field in DataGridColumnStyle Collection Editor somewhere? There is one called Format and I have entered "checkbox" in there, but makes no difference.

    What, if above unknown, is the syntax to hard code it?
    LVL 6

    Accepted Solution

    Look up DataGridBoolColumn in the VS help.

    Author Comment

    Thanks, found out that by default, the Forms.DataGridTextBoxColumn class was used. Change it to the derived DataGridBoolColumn class and the desired results are achieved i.e.

    Change from:
    Friend WithEvents DataGridTextBoxMyCol As System.Windows.Forms.DataGridTextBoxColumn

    Friend WithEvents DataGridBoolMyCol As System.Windows.Forms.DataGridBoolColumn

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
    Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
    This video discusses moving either the default database or any database to a new volume.
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now