如何在多个实例中初始化表单 [英] how to initialize a form in more than one instance

查看:76
本文介绍了如何在多个实例中初始化表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有一个用作过程日志的表单,用户可以在其中知道实际上正在运行什么进程,我创建了一个名为processlog的表单,并将该表单初始化为另一种名为frmmain的表单,并获取了值,但我必须初始化表单处理程序日志记录到另一种名为frmpublish的表单中,该表单如何以一种以上的形式初始化同一表单,以便可以正确维护值.

解决方案

没有这种问题.问题是您似乎不了解什么是形式":类型或实例(对象).任何类型都可以具有任意数量的实例,除非经过特殊设计使其表现得像 singleton 一样.这包括表格.您无需执行任何特殊操作即可实现此目标;只需创建多个相同类型的实例即可.不同实例的所有实例(非静态)成员将是独立的.不同的实例是不同的独立对象.也许在进行任何UI开发之前,您需要学习一些编程和OOP的基础知识.

—SA


hi
i have a form which is used as a proces log in which the user can know what process is actually running for this i have created a form called processlog and initialized the form in another form called frmmain and got the values but i have to initialize the form process log to another form called frmpublish how to initialize the same form in more than one form such that the values will be maintained correctly

解决方案

There is no such problem. The problem is that you seemingly do not understand what is "form": a type or a instance (object). Any type can have any number of instance unless it is specially designed to behave like a singleton. This includes the form. You don''t need to do anything special to achieve this; just create more than one instance of the same type. All instance (non-static) members of different instance will be independent. Different instances are different independent objects. Perhaps before doing any UI development you need to learn some basics of programming and OOP.

—SA


这篇关于如何在多个实例中初始化表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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