The problem with the format of the number in the cells, when I try to subtract the column data from datagridview and update the table in the database, I get an error to cast varchar to numeric. I understood that the problem is in the number delimiters, now it is "when it is standing." all OK. The data is transferred to the datagrid from the database, it is stored in the database with a period, but for some reason it is obtained in the datagrid with a comma. What to do?

So far, I have made such a crutch, I hope someone will tell the decision rules.

private String separator(String someString) { return someString.Replace(',', '.'); } 

    1 answer 1

    Control Panel => Clock, Language and Region => Regional Standards => Advanced Options ... => Put the required separator.

    Or you can try to manually specify in the properties of the column

     DataGridTextBoxColumn textColumn = new DataGridTextBoxColumn(); textColumn.FormatInfo = new CultureInfo("de-DE"); 
    • It is hemorrhoid in terms of each user explains. - Winteriscoming
    • @Winteriscoming offered another option, check - Exodium
    • Cheto does not work there is no such property dgv_mainWindow.Columns ["kg"]. FormatInfo or are you talking about the constructor? - Winteriscoming
    • @Winteriscoming Cast dgv_mainWindow.Columns ["kg"] explicitly to the DataGridTextBoxColumn type and see this property. - Exodium
    • Led does not help, changing the system separator, everything becomes ok, but I’m not happy with it ( - Winteriscoming