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 Test
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
            private void button1_Click(object sender, EventArgs e)
            {
                //首先实例化实例一个f2出来
                Form2 f2 = new Form2();
                //将文本框里面的值传给f2里面定义的str2变量里面
                f2.str2 = textBox1.Text;
                f2.ShowDialog();
            }
            private void Form1_Load(object sender, EventArgs e)
            {

    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 Test
    {
        public partial class Form2 : Form
        {
            //定义一个公共变量str2来接收值
            public string str2 = "";

            public Form2()
            {
                InitializeComponent();
            }

            private void Form2_Load(object sender, EventArgs e)
            {
                textBox1.Text = str2;
            }
            private void button1_Click(object sender, EventArgs e)
            {
                Form3 f3 = new Form3();
                f3.str3 = textBox1.Text;
                f3.ShowDialog();
            }
        }
    }

  • 相关阅读:
    我和杨兄的不同的Code First简单权限设计
    JavaScript&JQ 004_JS闭包
    省市区三级联动[JSON+Jquery]
    JavaScript 005_JS数组的CRUD
    linq头脑风暴001_聚合函数
    类成员函数指针的特殊之处
    模拟手算,计算组合数C(m,n)
    命令行版扫雷(vc08)
    UNICODE,GBK,UTF8:编码格式的区别
    画高频PCB的心得
  • 原文地址:https://www.cnblogs.com/qq1206583608/p/4655330.html
Copyright © 2011-2022 走看看