zoukankan      html  css  js  c++  java
  • 窗口间传值(定义公共变量)

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;

    namespace YXSetingSystem
    {
        public partial class Form权限管理添加组 : Form
        {
            public bool IsOK = false;
            public string Title = "";

    //定义公共变量pnopname

            public string pno = "";
            public string pname = "";

           //public string PNO { get { return pname; } set { pname = value; } }

            private void button1_Click(object sender, EventArgs e)
            {
                this.Title = this.textBox1.Text.Trim();

    //给pname赋值等于this.textBox1.Text
                this.pname = this.textBox1.Text;
                this.IsOK = true;
                Form权限管理 f = new Form权限管理();

    //在窗体Form权限管理中用pname值
                f.pname = this.pname;
                this.Close();
            }

        }
    }

     Form权限管理添加组窗体里面的值传给Form权限管理

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using YXToolSystem;
    using DataSystem;

    namespace YXSetingSystem
    {
        public partial class FormF权限管理 : Form
        {
            public string pno = "";
            public string pname = "";

            public bool IsOK = false;
            public string PGLNO = "0";

            void save()
            {
                string sql = "delete from powergroup where pgtitleno='" + pno + "'";

                for (int i = 0; i < this.cDGV权限列表.Rows.Count; i++)
                {
                    List<YXToolSystem.SQLStruct> col = new List<YXToolSystem.SQLStruct>();
                    col.Add(new SQLStruct("PGTitleNO", pno));
                    col.Add(new SQLStruct("PGTitleName", pname));
                    col.Add(new SQLStruct("PGPBNO", this.cDGV权限列表.Rows[i].Cells["编号"].Value));
                    col.Add(new SQLStruct("PGPBAdd", (this.cDGV权限列表.Rows[i].Cells["添加"].Value.ToString() == "√")));
                    col.Add(new SQLStruct("PGPBAme", (this.cDGV权限列表.Rows[i].Cells["修改"].Value.ToString() == "√")));
                    col.Add(new SQLStruct("PGPBDel", (this.cDGV权限列表.Rows[i].Cells["删除"].Value.ToString() == "√")));
                    col.Add(new SQLStruct("PGPBSeeOne", (this.cDGV权限列表.Rows[i].Cells["查看个人"].Value.ToString() == "√")));
                    col.Add(new SQLStruct("PGPBSeeDepartment", (this.cDGV权限列表.Rows[i].Cells["查看部门"].Value.ToString() == "√")));
                    col.Add(new SQLStruct("PGPBSeeCompany", (this.cDGV权限列表.Rows[i].Cells["查看公司"].Value.ToString() == "√")));
                    col.Add(new SQLStruct("PGPBSeeALL", (this.cDGV权限列表.Rows[i].Cells["查看全部"].Value.ToString() == "√")));
                    sql += SQLGet.Add(col, "powergroup");
                }
                if (ClassData.UpDate(sql) > 0)
                {
                    MessageBox.Show("设置成功!");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("设置失败!");
                }
            }

        }

    }

  • 相关阅读:
    Dynamics 365 多租户?多实例?
    接口接收gzip压缩数据并解压
    系统检测到在一个调用中尝试使用指针参数时的无效指针地址 问题
    PBI DAX 中GroupBy
    将sql 查询结果导出到excel
    自动生成数据库表分区脚本
    快速生成导入亿级测试数据到sqlserver
    powershell 版本问题
    运行powershell 脚本 在此系统上禁止运行脚本
    python网站收集
  • 原文地址:https://www.cnblogs.com/qq1206583608/p/4655009.html
Copyright © 2011-2022 走看看