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

📄 bpjs.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;
using System.Data.SqlClient;

namespace cwgl.inc
{
    public partial class bpjs : Form
    {
        public TextBox tb;
        public string tx;
        public bpjs(TextBox tb1, string tx1)
        {
            InitializeComponent();
            tb = tb1;
            tx = tx1;
        }
        public bpjs()
        {
            InitializeComponent();
        }


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

        }

        private void textBox3_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (float.Parse(textBox3.Text.ToString().Trim()) >= 0)
                {
                    float t1 = float.Parse(textBox2.Text.ToString().Trim());
                    float t2 = float.Parse(textBox3.Text.ToString().Trim());
                    float t3 = float.Parse(textBox4.Text.ToString().Trim());
                    float all = t1 - t2 - t3;
                    textBox5.Text = all.ToString().Trim();
                }

                else
                {
                    MessageBox.Show("请输入正整数", "提示");
                    this.textBox3.Text = "0";
                }
            }
            catch (FormatException e1)
            {
                MessageBox.Show(e1.Message, "请输入数字");
                this.textBox3.Text = "0";
            }
        }

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

        private void textBox5_TextChanged(object sender, EventArgs e)
        {
            try
            {
                float t1 = float.Parse(textBox5.Text.ToString().Trim());
                float t2 = float.Parse(textBox6.Text.ToString().Trim());
                float all = t2 - t1;
                textBox7.Text = all.ToString().Trim();
            }
            catch (FormatException e1)
            {
                MessageBox.Show(e1.Message, "请输入数字");
            }
        }

        private void textBox6_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (float.Parse(textBox6.Text.ToString().Trim()) >= 0)
                {
                float t1 = float.Parse(textBox5.Text.ToString().Trim());
                float t2 = float.Parse(textBox6.Text.ToString().Trim());
                float all = t2 - t1;
                textBox7.Text = all.ToString().Trim();
               }
               else
              {
                MessageBox.Show("请输入正整数", "提示");
                this.textBox6.Text = "0";
               }
            }
            catch (FormatException e1)
            {
                MessageBox.Show(e1.Message, "请输入数字");
                this.textBox6.Text = "0";
            }
        }

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

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

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (float.Parse(this.textBox1.Text.ToString().Trim()) >= 0)
                {

                    float t1 = float.Parse(this.textBox1.Text.ToString().Trim());
                    
                }
                else
                {
                    MessageBox.Show("请输入正整数","提示");
                    this.textBox1.Text = "0";
                }
            }
            catch (FormatException e1)
            {
                MessageBox.Show(e1.Message, "请输入数字");
                this.textBox1.Text = "0";
            }

        }

        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            this.comboBox1.Text = Convert.ToString(dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[0].Value);
            this.textBox1.Text = Convert.ToString(dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[1].Value);
            this.textBox2.Text = Convert.ToString(dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[2].Value);
            this.textBox3.Text = Convert.ToString(dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[3].Value);
            this.textBox4.Text = Convert.ToString(dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[4].Value);
            this.textBox6.Text = Convert.ToString(dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[6].Value);

        }

        private void bpjs_Load(object sender, EventArgs e)
        {
            // TODO: 这行代码将数据加载到表“sfxmds.sfxmb”中。您可以根据需要移动或移除它。
            this.sfxmbTableAdapter.Fill(this.sfxmds.sfxmb);

        }

       
    }
}

⌨️ 快捷键说明

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