将值从父窗体传递到子窗体 [英] Passing Values from parent form to child form

查看:109
本文介绍了将值从父窗体传递到子窗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1)有什么方法可以将值从父窗体传递到子窗体,例如构造函数,参数.

2)我们如何将父级的值传递给子级,以示例应用程序基于父级值将结果转换为子级.

1)what are the ways to pass a value from parent form to child form like constructors,parameters.

2)How can we pass the value from parent from to child form ,to get the results into child form based on parent form value with sample application.

推荐答案

没有父母"和孩子"形式的关系,有所有者"和拥有"形式.如果需要应用程序完整性,则确实需要使用此关系.

对于传递和数据以及表格之间的任何合作,这种关系并不重要.它可以是同一程序集的任何形式.

我坚持使用基于表单之一实现的某些接口的我的"最健壮的方法.请看下面.有几种不同的方法.您可以在此讨论中找到所有内容:

如何在列表框之间复制所有项目两种形式 [ ^ ].

—SA
There is not "parent" and "child" form relationship, there is "Owner" and "Owned" forms. You really need to use this relationship if you need application integrity.

As to passing and data and any cooperation between forms, this relatioship just does not matter. It could be any forms of the same assembly.

I insist on using "my" most robust method based on some interface implemented on one of the form. Please see below. There are few different approached. You can find it all in this discussion:

How to copy all the items between listboxes in two forms[^].

—SA


选中此项.

在表单之间传递数据 [此处 [
Check this.

Passing Data Between Forms[^]

For more info here[^].


这篇关于将值从父窗体传递到子窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆