• 大小: 45KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-29
  • 语言: C#
  • 标签:

资源简介

C#WinForm获取子窗口返回值 及窗口取消的处理

资源截图

代码片段和文件信息

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

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender EventArgs e)
        {
            Form2 frm2 = new Form2();//将子窗口实例化
            frm2.ShowDialog();//用模态对话框方式打开子窗口
            if (frm2.DialogResult == DialogResult.OK)//frm2窗口点击OK是要警醒处理的结果
            {
                textBox1.Text = frm2.datasource;//将textbox1赋值上frm2的返回属性
            }
            if (frm2.DialogResult == DialogResult.Cancel)
            {
                MessageBox.Show(“没有返回值“);
            }
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      10240  2012-04-10 08:43  子窗口返回值\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe

     文件      30208  2012-04-10 08:43  子窗口返回值\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.pdb

     文件      11608  2012-04-10 08:44  子窗口返回值\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe

     文件        490  2010-03-17 22:39  子窗口返回值\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe.manifest

     文件        942  2012-04-10 08:43  子窗口返回值\WindowsFormsApplication1\Form1.cs

     文件       2538  2012-04-10 08:32  子窗口返回值\WindowsFormsApplication1\Form1.Designer.cs

     文件       5817  2012-04-10 08:32  子窗口返回值\WindowsFormsApplication1\Form1.resx

     文件        983  2012-04-10 08:41  子窗口返回值\WindowsFormsApplication1\Form2.cs

     文件       3159  2012-04-10 08:41  子窗口返回值\WindowsFormsApplication1\Form2.Designer.cs

     文件       5817  2012-04-10 08:41  子窗口返回值\WindowsFormsApplication1\Form2.resx

     文件       5458  2012-04-10 08:43  子窗口返回值\WindowsFormsApplication1\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件       1078  2012-04-10 08:41  子窗口返回值\WindowsFormsApplication1\obj\x86\Debug\GenerateResource-ResGen.read.1.tlog

     文件       1548  2012-04-10 08:41  子窗口返回值\WindowsFormsApplication1\obj\x86\Debug\GenerateResource-ResGen.write.1.tlog

     文件       1400  2012-04-10 08:44  子窗口返回值\WindowsFormsApplication1\obj\x86\Debug\WindowsFormsApplication1.csproj.FileListAbsolute.txt

     文件      10240  2012-04-10 08:43  子窗口返回值\WindowsFormsApplication1\obj\x86\Debug\WindowsFormsApplication1.exe

     文件        180  2012-04-10 08:41  子窗口返回值\WindowsFormsApplication1\obj\x86\Debug\WindowsFormsApplication1.Form1.resources

     文件        180  2012-04-10 08:41  子窗口返回值\WindowsFormsApplication1\obj\x86\Debug\WindowsFormsApplication1.Form2.resources

     文件      30208  2012-04-10 08:43  子窗口返回值\WindowsFormsApplication1\obj\x86\Debug\WindowsFormsApplication1.pdb

     文件        180  2012-04-10 08:41  子窗口返回值\WindowsFormsApplication1\obj\x86\Debug\WindowsFormsApplication1.Properties.Resources.resources

     文件        485  2012-04-10 08:22  子窗口返回值\WindowsFormsApplication1\Program.cs

     文件       1396  2012-04-10 08:22  子窗口返回值\WindowsFormsApplication1\Properties\AssemblyInfo.cs

     文件       2896  2012-04-10 08:22  子窗口返回值\WindowsFormsApplication1\Properties\Resources.Designer.cs

     文件       5612  2012-04-10 08:22  子窗口返回值\WindowsFormsApplication1\Properties\Resources.resx

     文件       1107  2012-04-10 08:22  子窗口返回值\WindowsFormsApplication1\Properties\Settings.Designer.cs

     文件        249  2012-04-10 08:22  子窗口返回值\WindowsFormsApplication1\Properties\Settings.settings

     文件       3759  2012-04-10 08:41  子窗口返回值\WindowsFormsApplication1\WindowsFormsApplication1.csproj

     文件        914  2012-04-10 08:22  子窗口返回值\WindowsFormsApplication1.sln

    ..A..H.     18944  2012-04-10 08:43  子窗口返回值\WindowsFormsApplication1.suo

     目录          0  2012-04-10 08:44  子窗口返回值\WindowsFormsApplication1\obj\x86\Debug\TempPE

     目录          0  2012-04-10 08:44  子窗口返回值\WindowsFormsApplication1\obj\x86\Debug

............此处省略10个文件信息

评论

共有 条评论

相关资源