惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The GitHub Blog
The GitHub Blog
云风的 BLOG
云风的 BLOG
T
Threatpost
WordPress大学
WordPress大学
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
PCI Perspectives
PCI Perspectives
T
The Exploit Database - CXSecurity.com
Y
Y Combinator Blog
雷峰网
雷峰网
爱范儿
爱范儿
The Hacker News
The Hacker News
Last Week in AI
Last Week in AI
Simon Willison's Weblog
Simon Willison's Weblog
T
Tor Project blog
S
Securelist
宝玉的分享
宝玉的分享
L
LangChain Blog
O
OpenAI News
AI
AI
P
Privacy International News Feed
L
LINUX DO - 最新话题
D
DataBreaches.Net
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Attack and Defense Labs
Attack and Defense Labs
罗磊的独立博客
M
MIT News - Artificial intelligence
Security Archives - TechRepublic
Security Archives - TechRepublic
月光博客
月光博客
博客园 - 【当耐特】
T
Tailwind CSS Blog
C
Cybersecurity and Infrastructure Security Agency CISA
H
Help Net Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园_首页
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Hacker News - Newest:
Hacker News - Newest: "LLM"
腾讯CDC
Jina AI
Jina AI
The Last Watchdog
The Last Watchdog
K
Kaspersky official blog
Webroot Blog
Webroot Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Blog — PlanetScale
Blog — PlanetScale
MyScale Blog
MyScale Blog
MongoDB | Blog
MongoDB | Blog
P
Proofpoint News Feed
Recorded Future
Recorded Future
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
博客园 - 三生石上(FineUI控件)
The Cloudflare Blog

博客园 - pensir

ef报错:实体类型XXX不是当前上下文的模型的一部分。 让AutoCAD.NET支持后台线程 将cad嵌入到vb中 sql server 2005 msxml安装失败解决及msxml 6.0 卸载 智能替换DataTable.Select中会导致错误的单引号 - pensir - 博客园 CADVBA代码移植到.NET 最全ASCII码对照表(备用) C# 删除字符串中任何位置的空格 - pensir - 博客园 在VB.NET中使用MS Access存储过程(转载) Access存储过程,环境:VB 2005+.NET2.0+ACCESS2003(转载) 关键性代码整理 WinForm主要控件分类一览 MaskedTextBox掩码元素一览 ArcGIS中的坐标系统 Geodatabase组织结构 GIS关键词 栅格数据与矢量数据 ArcGIS的文件结构 winform+c#之窗体之间的传值 - pensir - 博客园
WinForm窗体间传值
pensir · 2008-11-19 · via 博客园 - pensir

Form1——主窗体:

namespace FirstDlg
{
    public partial class Form1 : Form
    {
        private Form2 f;
        public Form1()
        {
            InitializeComponent();
        }
        public string TextStored
        {
            get { return tbTest.Text; }
            set { tbTest.Text = value; }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            tbTest.Text = f.TextStored;//属性传值
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            f = new Form2();
            f.Show();
        }
    }
}

Form2——对话框窗体:

namespace FirstDlg
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }
        public string TextStored
        {
            get { return tbTest.Text; }
            set { tbTest.Text = value; }
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            foreach (Form form in Application.OpenForms)//搜索窗体名称
            {
                if (form.Name == "Form1")
                {
                    Form1 f = (Form1)form;
                    tbTest.Text = f.TextStored;
                }
            }
        }
    }
}