Example #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            colTfnos                = FactoriaCTelefono.ObtenerColeccionCTelefono();
            listTfnos.DataSource    = colTfnos;
            listTfnos.DisplayMember = "Nombre";
            ctTfnoSelec.DataBindings.Add("Text", colTfnos, "Telefono");

            cm = listTfnos.BindingContext[colTfnos] as CurrencyManager;
        }
Example #2
0
        private void btAñadir_Click(object sender, EventArgs e)
        {
            decimal tef = 0;

            if (ctNombre.Text.Length != 0 && ctTfno.Text.Length != 0 &&
                Decimal.TryParse(ctTfno.Text, out tef))
            {
                colTfnos.Add(FactoriaCTelefono.CrearCTelefono(ctNombre.Text, tef));
                cm.Position = cm.Count;
                cm.Refresh();
            }
        }