Home Forums WinForms controls Xceed Grid for WinForms Thousand seperator with Maskviewer

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #13381 |

    Hi all,

    I use Grid 2.2 and try to use the Maskviewer but unfortunately it does not display the values as required 🙁 Maybe someone could help me with the correct format? Thanks

    This is the code:
    Dim maskViewer As New Xceed.Grid.Editors.GridMaskedTextBox
    maskViewer.Mask = “0,00”
    gridCol = New Xceed.Grid.Column(sColumn, GetType(Double))
    gridCol.CellViewer = maskViewer

    I tried it with 0 , . % in nearly every combination but it seems that the mask is just <b>added</b> in front of the numbers…? My goal is to have a thousand seperator in the numeric column, e.g.:
    13
    31.324
    5.434.523
    5.343,44
    (empty if ‘Nothing’)

    By the way, I used the german settings which are . for the thousands and , for the decimals, don’t be confused 😉
    Any ideas how to achieve this? Thanks!!

    Imported from legacy forums. Posted by Kai (had 3793 views)

    Xceed Support
    Member
    Post count: 5658

    Dear Kai,

    A mask can be used to edit strings of known fixed number of characters, such as credit card numbers, short date format (mm-dd-yyyy) and phone numbers for one region.

    Decimals require variable number of characters therefore a TextBox or a NumericUpDown control should do the job.

    You can format and parse your strings using a System.Globalization.NumberFormatInfo instance and methods like Decimal.Parse(), Decimal.ToString( IFormatProvider ).

    Imported from legacy forums. Posted by Vince [Xceed] (had 274 views)

    Xceed Support
    Member
    Post count: 5658

    In addition to that, I heard from another developper that in the Grid you could use the GridNumericBox as a viewer.

    Also you can use a FormatSpecifier on the column or the cell for formatting.

    Imported from legacy forums. Posted by Vince [Xceed] (had 344 views)

    Xceed Support
    Member
    Post count: 5658

    To show the thousand separator into a numeric column of the Grid it is as simple has setting the correct FormatSpecifier in the Cell or Column. In your case, simply putting “n” in the FormatSpecifier of the column should do the job (That will then format the cell using the thousand separator).

    This will work only when viewing the content, not when editing it.

    Imported from legacy forums. Posted by Francois (had 348 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi all,

    yes, really simply!! 🙂 Thanks for pushing me to the solution!!

    Imported from legacy forums. Posted by Kai (had 4369 views)

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.