-1
I need to make a if
where I check a set of options not to do a if
within another if
to check whether a field is filled or not, I want to do this with a single if
.
Ex if(valr1, valor2, valor3 != "")
Follows the code
DataSet ds = new DataSet();
ds.ReadXml(@"\\192.168.0.251\Geral_G.M\Expedicao\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();
emissao = Convert.ToDateTime(ds.Tables["ide"].Rows[0]["dhEmi"]);
saida = Convert.ToDateTime(ds.Tables["ide"].Rows[0]["dhSaiEnt"]);
txt_emissao.Text = Convert.ToString(emissao);
txt_saida.Text = Convert.ToString(saida);
the code does not seem to be related to the question. Can elaborate an example?
– Rovann Linhalis
Rovann and this same code, because I’m reading an xml, and I play the value inside the textbox, I just need to confirm if the values are coming from xml and filling the textbox, because I noticed that some xmls come without one of the information I need to fill the textbox.
– Junior Guerreiro
Poe example I have received some xlms without the output date, I need to confirm this and give a message to the user that this missing given in the read xml.
– Junior Guerreiro
I need to confirm the information in this block that I am receiving.
– Junior Guerreiro
Still confused, can you be more specific? I mean that the columns that are in the code (for example "xName") is what you want to validate? Do you want to know if all are filled in a single
if
?– Ricardo Pontual
Ricardo that’s right, I need to validate the information that is coming from xml.
– Junior Guerreiro
Seems more like a logic problem you’re using. In addition, NF-e provides the schematics in XSD, you can generate the classes and directly convert the xml into an object. The way you’re doing it gets more complicated...
– Rovann Linhalis
I get it, I’ll improve this code yes, thanks for the tip.
– Junior Guerreiro