[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 158
  • Last Modified:

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

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?
  • 2
1 Solution
make sure a DataGrid column is set up as a checkbox and not a regular column
IvanHowarthAuthor Commented:
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?
Look up DataGridBoolColumn in the VS help.
IvanHowarthAuthor Commented:
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now