When I click on "Save", the program does a check of Texbox
with a negotiation that I did not to let pass numbers repeat, the problem is that it of error if any Textbox
is blank. Here is the code I saved saving the information in an Excel worksheet. How do I not always use All Texbox
, how do I make it pass without acknowledging an error in the% blank% and send a default value Texbox
to Excel?
if (!string.IsNullOrEmpty(txtCaixa1.Text) && checarString(txtCaixa1.Text))
{
valores[0] = Convert.ToInt64(txtCaixa1.Text);
}
if (!string.IsNullOrEmpty(txtCaixa2.Text) && checarString(txtCaixa2.Text))
{
// usar o link para verificar se existem textBox iguais
if (!valores.Any(v => v.Equals(Convert.ToInt64(txtCaixa2.Text))))
{
valores[1] = Convert.ToInt64(txtCaixa2.Text);
txtCaixa2.BackColor = Color.White;
}
else
{
txtCaixa2.BackColor = Color.Yellow;
messageBoxButtons();
return;
}
}
_oleCmd.CommandText = _Consulta;
_oleCmd.Parameters.Add("@MODELOS", OleDbType.VarChar, 50).Value = txtModelo.Text.Trim();
_oleCmd.Parameters.Add("@QUANTIDADE", OleDbType.VarChar, 255).Value = txtTotalCarton.Text.Trim();
_oleCmd.Parameters.Add("@NUMEROCARTON", OleDbType.Integer).Value = Convert.ToInt32(txtCarton.Text);
_oleCmd.Parameters.Add("@SN1", OleDbType.Integer).Value = Convert.ToInt32(txtCaixa1.Text);
_oleCmd.Parameters.Add("@SN2", OleDbType.Integer).Value = Convert.ToInt32(txtCaixa2.Text);