在两种形式之间传递数据(不是MDI应用程序) [英] Pass data between two forms (not an mdi application)

查看:94
本文介绍了在两种形式之间传递数据(不是MDI应用程序)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
如何在两种形式之间传递数据.一种形式是作为父形式,另一种形式是在单击按钮事件时打开的子形式.我想将一些数据从子形式发送到已打开的父形式.这不是mdi应用程序,请帮助我.
谢谢,
Minakshi.

Hello,
How to pass data between two forms. One form is acting as a parent form and another form is a child form which is opened on button click event.I want to send some data from child form to already opened parent form . It is not an mdi apllication.Help me please.
Thanks,
Minakshi.

推荐答案

此处 [ ^ ]是一篇文章,描述了用于传递数据的不同技术表格之间. :)


Here[^] is an article which describes different techniques for passing data between forms. :)


写道:​​

我想将一些数据从子表单发送到已经打开的父表单

I want to send some data from child form to already opened parent form



您可以使用本文中介绍的对象方法"找到解决此问题的简单方法.此处的示例代码用于将数据从父级传递到子级,但是使用描述的方法将数据从子级传递到父级非常容易.试一试! :)



You can find simple solution to this problem by using the "Object Approach" described in the article. The sample code there is for passing data from parent to the child, but it is very easy to pass data from child to parent, using the described approach. Give it a try! :)


我认为您可以通过使用子表单的对象轻松访问该子表单的数据

例如
childform.controlid

childform.object
i think you can easily access data of the child form by using object of that form

for example
childform.controlid
or
childform.object


在我的头顶上,您可以:
Off the top of my head, you could:

  1. 向子表单添加公共属性.
  2. 从ShowDialog方法返回数据.
  3. 将委托传递给子表单调用的子表单的构造函数. /li>
  4. 在子表单上订阅事件.


这篇关于在两种形式之间传递数据(不是MDI应用程序)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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