public void btnInserir_Click(object sender, EventArgs e) { if (txtValor.Text != null) { pilha1.Inserir(Convert.ToInt32(txtValor.Text)); pilha1.Mostrar(lbPilha); fila1.Inserir(Convert.ToInt32(txtValor.Text)); fila1.Mostrar(lbFila); txtValor.Text = ""; } else { MessageBox.Show("Campo VALOR vazio, impossível de adicionar!", "Campo Vazio", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
//Responsável por inserir o valor digitado na fila e pilha public void btnInserir_Click(object sender, EventArgs e) { //Verificação do campo Valor - caso esteja vazio, a ação é anulada retornando uma mensagem if (txtValor.Text != null) { pilha1.Inserir(Convert.ToInt32(txtValor.Text)); pilha1.Mostrar(lbPilha); fila1.Inserir(Convert.ToInt32(txtValor.Text)); fila1.Mostrar(lbFila); txtValor.Text = ""; } else { MessageBox.Show("Campo VALOR vazio, impossível de adicionar!", "Campo Vazio", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }