Show yes / no in bool gridview column bound to data source in Winforms?

I have a gridview bound to a data source (Windows Forms, VB.NET). One of the columns is a boolean type property, and I want to show "yes / no" in the column instead of 0/1 or "true / false". Is it possible? Can you edit the display of columns that are related?

+3
source share
1 answer

I faced the same problem, unfortunately I did not find an elegant solution. Three workarounds are offered:

  • Add another property to the data source class, which returns a string representation of the logical property. Hide the column displaying the boolean value, display the column displaying the string value.
  • Add a column of an unrelated row, fill this column with the appropriate value for each row, and hide the column with a boolean character.
  • Create a wrapper class for your data class that provides the properties you want them to display in the datagrid.
+2
source

Source: https://habr.com/ru/post/1737008/


All Articles