⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gccb.cs

📁 实习时候做的一个c#的财务管理系统
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace cwgl
{
    public partial class gccb : Form
    {
        public TextBox tx;
        public gccb(TextBox tx1)
        {
            InitializeComponent();
            tx = tx1;
        }

        private void button3_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            textBox1.Text = "0";
            textBox2.Text = "0";
            textBox3.Text = "0";
            textBox4.Text = "0";            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            tx.Text = textBox5.Text.ToString().Trim() ;
            this.Close();
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (float.Parse(this.textBox1.Text.ToString().Trim()) >= 0)
                {
                    float t1 = float.Parse(textBox1.Text.ToString().Trim());
                    float t2 = float.Parse(textBox2.Text.ToString().Trim());
                    float t3 = float.Parse(textBox3.Text.ToString().Trim());
                    float t4 = float.Parse(textBox4.Text.ToString().Trim());
                    float all = t1 + t2 + t3 + t4;
                    textBox5.Text = all.ToString().Trim();
                }
                else
                {
                    MessageBox.Show("请输入正整数","提示");
                    this.textBox1.Text = "0";
                }
            }
            catch (FormatException e1)
            {
                MessageBox.Show(e1.Message, "请输入数字");
                this.textBox1.Text = "0";
            }
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (float.Parse(this.textBox2.Text.ToString().Trim()) >= 0)
                {
                    float t1 = float.Parse(textBox1.Text.ToString().Trim());
                    float t2 = float.Parse(textBox2.Text.ToString().Trim());
                    float t3 = float.Parse(textBox3.Text.ToString().Trim());
                    float t4 = float.Parse(textBox4.Text.ToString().Trim());
                    float all = t1 + t2 + t3 + t4;
                    textBox5.Text = all.ToString().Trim();
                }
                else
                {
                    MessageBox.Show("请输入正整数", "提示");
                    this.textBox2.Text = "0";
                }
            }
            catch (FormatException e2)
            {
                MessageBox.Show(e2.Message, "请输入数字");
                this.textBox2.Text = "0";
                
            }
        }

        private void textBox3_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (float.Parse(this.textBox3.Text.ToString().Trim()) >= 0)
                {
                    float t1 = float.Parse(textBox1.Text.ToString().Trim());
                    float t2 = float.Parse(textBox2.Text.ToString().Trim());
                    float t3 = float.Parse(textBox3.Text.ToString().Trim());
                    float t4 = float.Parse(textBox4.Text.ToString().Trim());
                    float all = t1 + t2 + t3 + t4;
                    textBox5.Text = all.ToString().Trim();
                }
                else
                {
                    MessageBox.Show("请输入正整数", "提示");
                    this.textBox3.Text = "0";
                }
            }
            catch (FormatException e3)
            {
                MessageBox.Show(e3.Message, "请输入数字");
                this.textBox3.Text = "0";
                
            }
        }

        private void textBox4_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (float.Parse(this.textBox4.Text.ToString().Trim()) >= 0)
                {
                    float t1 = float.Parse(textBox1.Text.ToString().Trim());
                    float t2 = float.Parse(textBox2.Text.ToString().Trim());
                    float t3 = float.Parse(textBox3.Text.ToString().Trim());
                    float t4 = float.Parse(textBox4.Text.ToString().Trim());
                    float all = t1 + t2 + t3 + t4;
                    textBox5.Text = all.ToString().Trim();
                }
                else
                {
                    MessageBox.Show("请输入正整数", "提示");
                    this.textBox4.Text = "0";
                }
            }
            catch (FormatException e4)
            {
                MessageBox.Show(e4.Message, "请输入数字");
                this.textBox4.Text = "0";
                
            }
        }

        private void gccb_Load(object sender, EventArgs e)
        {

        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -