How to format text in Datagrid.

  • Thread starter Thread starter cr113
  • Start date Start date
C

cr113

How do I format text in datagrid column? I have a column of currency
values and I want them all to display with 2 decimal points (XXX.XX).

I figured out how to set the width and alignment as follows:

DataGrid1.TableStyles(0).GridColumnStyles(0).Width = 140
DataGrid1.TableStyles(0).GridColumnStyles(1).Width = 125
DataGrid1.TableStyles(0).GridColumnStyles(0).Alignment = 0
DataGrid1.TableStyles(0).GridColumnStyles(1).Alignment = 1


P.S. Am I the only one who finds the Datagrid to be incredibly
complicated?
 
Hi,

Add a tablestyle to your datagrid

http://msdn.microsoft.com/library/d...ry/en-us/dnwinforms/html/wnf_custdatagrid.asp

http://msdn.microsoft.com/library/d...tingwindowsformsdatagridvisualbasicprimer.asp

Ken
---------------------

How do I format text in datagrid column? I have a column of currency
values and I want them all to display with 2 decimal points (XXX.XX).

I figured out how to set the width and alignment as follows:

DataGrid1.TableStyles(0).GridColumnStyles(0).Width = 140
DataGrid1.TableStyles(0).GridColumnStyles(1).Width = 125
DataGrid1.TableStyles(0).GridColumnStyles(0).Alignment = 0
DataGrid1.TableStyles(0).GridColumnStyles(1).Alignment = 1


P.S. Am I the only one who finds the Datagrid to be incredibly
complicated?
 
Back
Top