0
I’m making an import of tags from xml
to fields of textbox
in Windows Form, only that I am not able to import the data fields in the correct format, to a masktextbox
in date format.How do I proceed to show on textbox
the date in the correct format dd/MM/aaaa
.
Follows my code
DataSet ds = new DataSet();
ds.ReadXml(@"C:\Xml_Entrada\" + txt_chave.Text + ".xml");
txt_fornecedor.Text = ds.Tables["emit"].Rows[0]["xNome"].ToString();
txt_cnpj.Text = ds.Tables["emit"].Rows[0]["CNPJ"].ToString();
txt_nota.Text = ds.Tables["ide"].Rows[0]["nNF"].ToString();
txt_ie.Text = ds.Tables["emit"].Rows[0]["IE"].ToString();
txt_emissao.Text = ds.Tables["ide"].Rows[0]["dhEmi"].ToString();
txt_saida.Text = ds.Tables["ide"].Rows[0]["dhSaiEnt"].ToString();
Xml data
<dhEmi>2018-06-15T09:56:51-03:00</dhEmi>
<dhSaiEnt>2018-06-15T09:56:51-03:00</dhSaiEnt>
What format is the date coming from xml?
– Tuxpilgrim
Have you tried with
.ToString("dd/MM/yyyy")
?– Ricardo Pontual
I edited the question to put the date that came from xml
– Junior Guerreiro
I’ve tried Richard this way.
– Junior Guerreiro