Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try this one:</p> <pre><code>using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Diagnostics; namespace Test { public partial class Form1 : Form { public Form1() { DataSet dataSet1 = new DataSet("dataSet"); DataTable dataTable1 = dataSet1.Tables.Add("Table"); DataColumn dataColumn1 = dataTable1.Columns.Add("Valor", typeof(decimal)); dataTable1.PrimaryKey = new DataColumn[] { dataColumn1 }; DataRow dRow = dataSet1.Tables["Table"].NewRow(); dRow["Valor"] = Convert.ToDecimal("1985,56"); dataSet1.Tables["Table"].Rows.Add(dRow); dRow = dataSet1.Tables["Table"].NewRow(); dRow["Valor"] = Convert.ToDecimal("85,756"); dataSet1.Tables["Table"].Rows.Add(dRow); dRow = dataSet1.Tables["Table"].NewRow(); dRow["Valor"] = Convert.ToDecimal("145,6"); dataSet1.Tables["Table"].Rows.Add(dRow); InitializeComponent(); if (dataSet1 != null &amp;&amp; dataSet1.Tables.Count &gt; 0 &amp;&amp; dataSet1.Tables[0] != null &amp;&amp; dataSet1.Tables[0].Rows.Count &gt; 0) { foreach (DataRow dataRowTemp in dataSet1.Tables[0].Rows) { Debug.Print(dataRowTemp["Valor"].ToString()); } dataGridView1.DataSource = dataTable1; } //var provider = (CultureInfo)CultureInfo.CurrentCulture.Clone(); var provider = new System.Globalization.CultureInfo("pt-BR"); //var provider = new System.Globalization.CultureInfo("en"); dataGridView1.Columns["Valor"].DefaultCellStyle.FormatProvider = provider; dataGridView1.Columns["Valor"].DefaultCellStyle.Format = "C2"; dataGridView1.Columns["Valor"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload