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

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

To:
Friend WithEvents DataGridBoolMyCol As System.Windows.Forms.DataGridBoolColumn
0

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