datagrid on a windows form

A

ALI-R

have a datagrid on a windows form which bound to a dataset ,one column
contains boolean data which datagrid shows checkbox for it .I don't want
checkbox ,instead I want "yes" or "no" and I want "no" columns to be bold
,it is easy to do that on web forms by using prepair event or so on ,but
here in windows form which event or delegate should I use?

thanks for your help
 
D

Dmitriy Lapshin [C# / .NET MVP]

Hi,

You will need a custom DataGridColumnStyle for that. First, you will need to
override GetColumnValueAtRow and SetColumnValueAtRow methods to implement
conversion from boolean true/false to strings "Yes/No" and vica versa.

Next, you will have to override the Paint method to draw the "No" values in
bold.

Probably it might be a good idea to derive your column style from
DataGridTextBoxColumn, also see the MSDN docs on
System.Windows.Forms.DataGridColumnStyle.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top