如何在C#.net中将数据从一个表单移动到另一个表单 [英] How to move data from one Form to another Form in C#.net

查看:81
本文介绍了如何在C#.net中将数据从一个表单移动到另一个表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个表格analyse_query.cs和analyse_query1.cs。



i已经在analyse_query.cs表单中完成了一些字符串操作并将结果存储在两个变量中(make_new和model_new)。在第二种形式analyse_query1.cs我有两个文本框。我想在textbox2中获取make_new的值,在textbox2中获取model_new值。



请帮助我..

i have two form analyse_query.cs and analyse_query1.cs.

i have done some string manipulation in analyse_query.cs form and stored the result in two variables ( make_new and model_new). in second form analyse_query1.cs i have two text boxes . i want to get the value of make_new in textbox1 and model_new value in textbox2.

plz help me..

推荐答案

请参阅我为此目的撰写的文章:一次回答的许多问题 - Windows窗体或WPF Windows之间的协作 [< a href =http://www.codeproject.com/Tips/889332/Many-Questions-Answered-at-Once-Collaboration-betw\"target =_ blanktitle =New Window> ^ ] 。



-SA
Please see my article written for this purpose: Many Questions Answered at Once — Collaboration between Windows Forms or WPF Windows[^].

—SA


你究竟是怎么做的,取决于两种形式是怎样的相关。

看看这些:

在两种形式之间传递信息,第1部分:父母对儿童 [ ^ ]

在两种形式之间传递信息,第2部分:儿童到父母 [ ^ ]

在两种表格之间转移信息,第3部分:儿童与儿童 [ ^ ]

一它们将适合您的应用程序的工作方式。
Exactly how you do it depends on how the two forms are "related".
Have a look at these:
Transferring information between two forms, Part 1: Parent to Child[^]
Transferring information between two forms, Part 2: Child to Parent[^]
Transferring information between two forms, Part 3: Child to Child[^]
One of them will fit the way your application works.


您可以使用属性注入或构造函数注入。

依赖倒置原则和依赖注入模式 [ ^ ]
You could use property injection or constructor injection .
Dependency Inversion Principle and the Dependency Injection Pattern[^]


这篇关于如何在C#.net中将数据从一个表单移动到另一个表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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