Why can not I call object cta1
instantiated in btnCriarConta_Click
?
namespace proj3 {
public partial class conta : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
}
protected void btnCriarConta_Click(object sender, EventArgs e) {
try {
decimal saldo = decimal.Parse(txtSaldo.Text);
ContaBancaria cta1 = new ContaBancaria(1, saldo);
Session.Add("conta", cta1);
msgGeral.Text = "Conta criada com sucesso.";
}catch (Exception ex){
}
}
protected void btnDebitar_Click(object sender, EventArgs e) {
try {
cta1.debitar(decimal.Parse(txtSaldo.Text));
} catch (Exception ex) {
}
}
protected void btnCreditar_Click(object sender, EventArgs e)
{
try {
}catch (Exception ex) {
}
}
}
}