private void button6_Click(object sender, EventArgs e) { try { if (txtCodigo.Text != "") { txtNumero_Leave(sender, e); } else { limpar(); } if (txtCodigo.Text == "") { objCom.localizarProxAnterior("anterior", 0); } else { objCom.localizarProxAnterior("anterior", int.Parse(txtCodigo.Text)); } if (objCom.com_codigo != 0) { objCom.localizar(objCom.com_codigo.ToString(), "com_codigo"); txtCodigo.Text = objCom.com_codigo.ToString(); txtNumero_Leave(sender, e); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }