using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Ex_Banco
{
public partial class Form1 : Form
{
private Conta[] contas = new Conta[3];
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.contas[0].Titular = new Cliente("Victor", 18);
this.contas[0].Numero = 1;
this.contas[1].Titular = new Cliente("Maria", 21);
this.contas[1].Numero = 2;
this.contas[2].Titular = new Cliente("José", 30);
this.contas[2].Numero = 3;
/*foreach (Conta c in conta)
{
comboContas.Items.Add(c.Titular);
}*/
//Depositando 250 na conta.
this.contas[0].Deposita(250);
//Atribuindo os valores aos TextBoxes do formulário.
textoNumero.Text = Convert.ToString(this.contas[0].Numero);
textoSaldo.Text = Convert.ToString(this.contas[0].Saldo);
textoTitular.Text = contas[0].Titular.Nome;
}
private void depositar_Click(object sender, EventArgs e)
{
contas[0].Deposita(Convert.ToDouble(textoValor.Text));
textoSaldo.Text = Convert.ToString(contas[0].Saldo);
}
private void sacar_Click(object sender, EventArgs e)
{
contas[0].Saca(Convert.ToDouble(textoValor.Text));
textoSaldo.Text = Convert.ToString(contas[0].Saldo);
}
}
}