Change Display format in Datagrid control

Hello,

I tried to bind my database with Datagrid control as code below

grdTS.GridColumnStyles.Add(Cs2)
        Dim Cs3 As New DataGridTextBoxColumn
        With Cs3
            .HeaderText = "Mlx Part?"
            .MappingName = "B_IsMxp"
            .ReadOnly = True
            .Width = 30
        End With

In database B_IsMxp is boolean data type and when it's displayed, it can be only -false- or -True-

Can we change display format to be -Y- for true and -N- for false and blank for null value ?

Thanks and Regards
mpitakAsked:
Who is Participating?
 
tsayConnect With a Mentor Commented:
You can use the NullText property to define what should be displayed if the value is null in the database. In your example this would be

grdTS.GridColumnStyles.Add(Cs2)
        Dim Cs3 As New DataGridTextBoxColumn
        With Cs3
            .HeaderText = "Mlx Part?"
            .MappingName = "B_IsMxp"
            .ReadOnly = True
            .Width = 30
            .NullText = ""
        End With

I'll look into formatting the boolean value
0
 
Bob LearnedConnect With a Mentor Commented:
Why don't you use a DataGridBoolColumn, and have a check box.

Bob
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.