Results 1 to 4 of 4

Thread: [RESOLVED] Change decimal symbol to period not comma

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2016
    Location
    South Africa
    Posts
    141

    Resolved [RESOLVED] Change decimal symbol to period not comma

    I have a VB.NET application using a MySQL database.

    My datagridview shows decimal values from the database with a comma as a symbol - I would like it to show a period (.). My regional settings are set to a period. However the DGV shows a comma. I have tried to change the DGV çolumn format to N2, but no change.

    What am I missing?

    Regards

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Change decimal symbol to period not comma

    If you were working with numbers then they would be formatted as per your system settings. If that's not what you're seeing then you're almost certainly working with text. Where and how that might be happening is anyone's guess, given that you decided that asking us what you were doing wrong without showing us what you're doing would be a good idea. We should NEVER have to prompt you to show us the relevant code.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2016
    Location
    South Africa
    Posts
    141

    Re: Change decimal symbol to period not comma

    Sorry my bad.
    My dataset locale was different from my regional settings.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: [RESOLVED] Change decimal symbol to period not comma

    That's interesting. The documentation for that property describes it thusly:
    Gets or sets the locale information used to compare strings within the table.
    That doesn't seem to relate you your issue so I would not have expected it to be relevant. The cells of the grid can only display text, so any value that isn't a String needs to be converted. If you had a DataColumn containing numeric values then I would have expected the grid to be the one doing that conversion, so the Locale of the DataSet would be irrelevant. What you're saying seems to suggest that the conversion is being done by the DataTable rather than the DataGridView and I'm not sure why that would be. I'd still be interested to know exactly how this data is being loaded.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width