Adding mask to DataGridView columns

  • Thread starter Thread starter Andrus
  • Start date Start date
A

Andrus

I need to create WinForms DataGridView column which shows spaces between
thousands.
I have found that MaskedTextBox Mask property supports this

I tried to add column to DataGridView using

var column = new DataGridViewMaskedTextBoxColumn();
column.Mask= "99 999 999.99";

but got error because DataGridViewMaskedTextBoxColumn does not exist.

How to add Mask to DataGridView column ?

Andrus.
 
I need to create WinForms DataGridView column which shows spaces between
thousands.
I have found that MaskedTextBox Mask property supports this

I tried MSDN DataGridview Masked TextBox column sample.
This sample displays mask only for current cell, not to whole column.

I tried to use

public MaskedTextBoxCell()
: base()
{
DisplayStyleForCurrentCellOnly = false;
....

But got error since DisplayStyleForCurrentCellOnly does not exist for
TextBox cells.

How to show amouts in every row separated with space like

1 234.55
22 444.44
343 333.33
3 333.45


Andrus.
 
Back
Top