• 窗口间传值(定义公共变量)


    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("设置失败!");
                }
            }

        }

    }

  • 相关阅读:
    [转] 64位Oracle 11g R2的客户端连接时报ORA-01019错误
    [转]Oracle11g链接提示未“在本地计算机注册“OraOLEDB.Oracle”解决方法
    [转]通过Net Manager 配置Oracle 11g本地监听服务(listener service)
    [转]jQuery Mobile动态刷新页面样式
    [转]SSIS
    [转]在SSIS中,使用“包配置”时的常见错误与解析
    使用JMH做Java微基准测试
    秒杀系统解决方案
    cookie机制和session机制
    app如何节省流量
  • 原文地址:https://www.cnblogs.com/qq1206583608/p/4655009.html
Copyright © 2020-2023  润新知