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

        }

    }

  • 相关阅读:
    .NET 内存分配笔记
    MYSQL知识点
    NOPI导入导出
    【链接】各类学习资源
    【原创】重绘winform的GroupBox
    高仿淘宝滑动验证码插件
    Winform窗体控件级权限处理
    .NET中的Func委托用法
    关于IBatisNet的配置文件中数据库连接字符串加密处理
    Oracle连接字符串大全
  • 原文地址:https://www.cnblogs.com/qq1206583608/p/4655009.html
Copyright © 2011-2022 走看看