How to create DataGrid column parser?

G

Guest

In my .net application I use Windows.Forms.DataGrid bound to the datasource
to dispaly database contents. The bounding is done with GridColumnStyle and
its property MappingName which is associated with the name of a DataTable
column. Moreover the Format property of GridColumnStyle is set to "c2" to
dispaly numeric values as currency. It works fine however only in one
direction when the data is beeing displayed in the grid. The troubles start
when I want to input data via this grid. I can not just change the value in
the cell because it has currency suffix. It is necessary to remove the suffix
and then value passes validation and it is stored in the DataTable. When I am
working with a simple control (e.g. TextBox) I can modify its Binding and add
a parser. In case of DataGrid I can not get to the Binding. The
BindingContext property of the DataGrid is empty when columns are created.
Could you please suggest how to add a parser to DataGrid control column to
accept "c2" numeric values?
 
G

Guest

Tanks. Though I prefer C# the sample code from KB in VisualBasic is very
helpful.

A.Kniat
 

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