示例#1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (this.TXTvalor.TextLength > 0 || this.TXTpersona.TextLength > 0 || this.TXTconcepto.TextLength > 0)
     {
         Gasto gas = new Gasto(Convert.ToDouble(this.TXTvalor.Text), this.TXTpersona.Text, this.TXTconcepto.Text);
         if (gas.RegistrarGasto(DTPfechagasto.Value.ToShortDateString()))
         {
             MessageBox.Show("Gasto insertado con exito", "informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
             this.bttnguardar.Enabled = false;
             this.bttnnuevo.Enabled   = true;
             groupBox1.Enabled        = false;
         }
         else
         {
             MessageBox.Show("Error al momento de insertar los datos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         MessageBox.Show("Faltan datos", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }