private void BtnCalcular_Click(object sender, EventArgs e)
        {
            if (TxtCant.Text.Trim().Length == 0)
            {
                MessageBox.Show("Ingrese un dato");
                TxtCant.Focus();
                return;
            }

            if (TxtPrecu.Text.Trim().Length == 0)
            {
                MessageBox.Show("Ingrese un dato");
                TxtPrecu.Focus();
                return;
            }

            double cant, precu, totalp;

            cant  = Convert.ToDouble(TxtCant.Text);
            precu = Convert.ToDouble(TxtPrecu.Text);

            totalp = cant * precu;

            TxtTotalp.Text = totalp.ToString();
        }
示例#2
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (TxtDescrip.Text.Trim().Length == 0)
            {
                MessageBox.Show("INGRESE UN DATO");
                TxtDescrip.Focus();
                return;
            }
            if (TxtCant.Text.Trim().Length == 0)
            {
                MessageBox.Show("INGRESE UN DATO");
                TxtCant.Focus();
                return;
            }
            if (TxtPrecu.Text.Trim().Length == 0)
            {
                MessageBox.Show("INGRESE UN DATO");
                TxtPrecu.Focus();
                return;
            }
            cant  = Convert.ToDouble(TxtCant.Text);
            precu = Convert.ToDouble(TxtPrecu.Text);
            LstMostrar.Items.Add(TxtDescrip.Text.Trim());
            LstCatn.Items.Add(TxtCant.Text.Trim());
            LstPrecu.Items.Add(TxtPrecu.Text.Trim());
            LstTotal.Items.Add(cant * precu);

            TxtCant.Clear();
            TxtDescrip.Clear();
            TxtPrecu.Clear();
            TxtDescrip.Focus();
        }
 private void BtnLimpiar_Click(object sender, EventArgs e)
 {
     TxtCant.Clear();
     TxtPrecu.Clear();
     TxtTotalp.Clear();
     TxtCant.Focus();
 }
示例#4
0
        private void BtnCalcular_Click(object sender, EventArgs e)
        {
            if (TxtCant.Text.Trim().Length == 0)
            {
                MessageBox.Show("Ingrese los datos");
                TxtCant.Focus();
                return;
            }


            if (TxtPrecu.Text.Trim().Length == 0)
            {
                MessageBox.Show("Ingrese los datos");
                TxtPrecu.Focus();
                return;
            }

            double cant, precu, desc, totalp, tp;

            cant  = Convert.ToDouble(TxtCant.Text.Trim());
            precu = Convert.ToDouble(TxtPrecu.Text.Trim());

            totalp = cant * precu;

            if (cant >= 3)
            {
                desc = totalp * 0.2;
            }
            else
            {
                desc = 0;
            }

            tp             = totalp - desc;
            TxtdDesc.Text  = TxtdDesc.Text + desc;
            TxtTotalp.Text = TxtTotalp.Text + tp;
        }