-2
I need to show a column in the raw weight column datagridview this format 0.00, but I’m not getting, this column is not created in any database, I created the column directly in datagridview, I’ve been in the column numeric formatting, I left it as N2, and still no formatting of the column. I need that when I type a decimal number in the column, EX type 10 when leaving the cell, need to show 10.00
Follow my code:
private void btn_xml_Click(object sender, EventArgs e)
{
string FileName = @"C:\Xml_Entrada\" + txt_chave.Text + ".xml";
List<ClasseItensXml> ListaItens = new List<ClasseItensXml>(); //A lista é do tipo ClasseItensXml
XmlDocument doc = new XmlDocument();
doc.Load(FileName);
var proditens = doc.GetElementsByTagName("prod");
foreach (XmlElement nodo in proditens)
{
ListaItens.Add(
new ClasseItensXml()
{
CodigoProduto = nodo.GetElementsByTagName("cProd")[0].InnerText.Trim(),
NomeProduto = nodo.GetElementsByTagName("xProd")[0].InnerText.Trim(),
QuantidadeComercializada = nodo.GetElementsByTagName("qCom")[0].InnerText.Trim()
});
//Repare que cada "nodo" é um item, portanto só adiciona um ClasseItensXml na lista.
}
dgw_Xml.DataSource = ListaItens; //por fim, usa a lista de source
dgw_Xml.Columns["PesBruto"].DefaultCellStyle.Format = "N2";
}
Young man, I ask you from the bottom of my heart to format the code of this question.
– Jéf Bueno