Solved

Format/Formatinfo of datagrid (vs2003) not formating the data

Posted on 2006-06-29
2
285 Views
Last Modified: 2008-02-01
Hi there,

I have a datagrid setup and its working but its not showing the thousand separater (which in spain we use the . rather than the ,)

so hence 10000 would be represented like so 10.000

I have some code which i thought would work but it isn't. This column i have has values that exceeed 10000 for example.. here is my code

                  System.Globalization.CultureInfo SpanishCultureInfo=
                        new CultureInfo(0x0C0A);
     
                  ts = new DataGridTableStyle();
                  ts.MappingName="Record";
                  
                  style2=new DataGridTextBoxColumn();
                  style2.MappingName="NUM_TITULOS";
                  style2.HeaderText="Titulos";
                  style2.Alignment = HorizontalAlignment.Right;
                  style2.FormatInfo = SpanishCultureInfo;
                  style2.Format = "c";
                  ts.GridColumnStyles.Add(style2);

All the other stuff in the style2 is working i..e Right Alignment, mapping and headertext etc-... the formatinfo/format doesn't seem to be working... as in that column all values are not expressed with the . (dot) as the thousand separater

Can anyone help?

Maybe the column is of type STRING..... but should that make a difference?

Thanks in advance

Ian
0
Comment
Question by:ianinspain
2 Comments
 
LVL 5

Accepted Solution

by:
t_itanium earned 500 total points
ID: 17011535
look


after binding your datagrid go over each row of  it change the format of the desired column///


foreach row i datagridrows
{
do the formating here

}

somehting like this..

cheers
0
 

Author Comment

by:ianinspain
ID: 17019038
Yep this is what i ended up doing was changing the dataset rather than the grid...

thanks

ian
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now