如何在另一个子表单的子表单上的文本框上设置值 [英] How to set a value on textbox on a child form from another child form
本文介绍了如何在另一个子表单的子表单上的文本框上设置值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在另一个子表单的子表单上设置文本框上的值
我想要做的就是将一个值从form3设置为一个文本框表格2
form1是父母
form2和form3是孩子
$ b $从form2上的按钮调用form3,然后点击form3上的按钮,然后在form2上更改文本框的文本
我已经尝试了两种没有父母和孩子的形式,而且工作正常。我对儿童形式有问题。
我试过的:
how to set a value on textbox on a child form from another child form
all i want to do is to set a value from form3 to a textbox on a form 2
form1 is parent
form2 and form3 are child
i call form3 from a button on form2 and then want to click on a button on form3 and change text of a textbox on form2
i've tried this on two forms that are no parent and child and it works fine buy i have problem with to child form.
What I have tried:
'From form2
Form3.showdialog()
'from form3
form2.textbox1.text="Test"
推荐答案
基本上,你没有,它违背OOP设计的所有原则。
而不是通过父表格:在两种形式之间传递信息,第3部分:儿童与儿童 [ ^ ] - 代码在C#中,但它非常明显,在线转换器应该帮助你不要做任何事情明白:代码转换器C#到VB和VB到C# - Telerik [ ^ ]
Basically, you don't, it goes against all the principles of OOPs design.
Instead you go via the parent form: Transferring information between two forms, Part 3: Child to Child[^] - the code is in C#, but it's pretty obvious, and online converters should help with anything you don't understand: Code Converter C# to VB and VB to C# – Telerik[^]
你的说法不是很有用......
基本上我会建议您在这些儿童表格上创建自己的活动。事件可以告诉父母有事情要做。您还可以向事件添加结果或值的值。事件本身就是你喜欢的动作......
另一种方法是使用被调用的Form作为对话框。在这里,您可以使用Dialogresult和一个属性传递所需的信息......
这不是完整的解决方案,但它可能会引导您朝着允许的方向前进为您提供更多具体信息......
Your desciption is not very useful ...
Basicly I would suggest that you create your own Events on those 'Child'-Forms. An Event can tell a Parent that there is something to do. You could also add a Result or a Value of something to an Event. The Event itself is raised with the action you like ...
Another way could be to use the called Form as a Dialog. Here you could perhaps pass the required Information with the Dialogresult and a Property ...
This is not the complete Solution but perhaps it guides you in a direction which allows to give you more and specific Information ...
这篇关于如何在另一个子表单的子表单上的文本框上设置值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文