如何从另一个表单中打开一个表单?

编程入门 行业动态 更新时间:2024-10-10 15:27:46
本文介绍了如何从另一个表单中打开一个表单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

作为一个刚刚看过VB的老程序员,我有一个问题: 如何从另一个表单中打开一个表单?我不是说一个人如何创建该表单的新实例,而是如何引用那个表单? 这样做了,怎么一个从这个表单获取数据? 我已经阅读了MS教程,但这是无意义的复杂;那里 必须是一个简单,直接的方法,或者我只能假设MS已经在OO痴迷的荒谬之后销毁了一个有用的工具(VB)。 /> .....

As an old programmer just now looking at VB I have a question: How does one simply open one form from another ? I don''t mean how does one create a new instance of that form , but rather how to refer to THAT form ? And having done this, how does one get data to and from that form ? I have read the MS tutorial on this but it is senselessly complex; there must be a simple, straightforward method, or I can only assume that MS has destroyed a useful tool (VB) in the absurd following of the OO obsession .....

推荐答案

Barret, 我不喜欢知道什么是有用的工具,但是你现在可以直接从你的主表单中创建不同的 表格。 有MDI子表单,对话框和普通的形式。 基本上它都是一样的但显示的方式是不同的 的正常形式它是 \\\ dim frm as new form2 frm.show /// 就是这样。 我希望这有帮助吗? Cor Barret Bonden Barret, I don''t know what that usefull tool is, however you now create different kind of forms and directly from your main form. There are MDI child forms, dialogforms and normal form. Basicly it is all the same however the way of showing is different for a normal form it is \\\ dim frm as new form2 frm.show /// That is all. I hope this helps? Cor "Barret Bonden" 作为一个刚刚看过VB的老程序员,我有一个问题: 如何从一个表单中打开一个表单另一个?我不是说如何创建该表单的新实例,而是如何引用该表单?这样做,如何获取数据和从那个表格? 我已经阅读了关于这个的MS教程,但它是无意义的复杂; 必须是一个简单,直接的方法,或者我只能假设MS已经在OO痴迷的荒谬追随中摧毁了一个有用的工具(VB)....... /> As an old programmer just now looking at VB I have a question: How does one simply open one form from another ? I don''t mean how does one create a new instance of that form , but rather how to refer to THAT form ? And having done this, how does one get data to and from that form ? I have read the MS tutorial on this but it is senselessly complex; there must be a simple, straightforward method, or I can only assume that MS has destroyed a useful tool (VB) in the absurd following of the OO obsession ....

" Barret Bonden" < AR **** @ networks-cc> schrieb: "Barret Bonden" <ar****@networks-cc> schrieb: 作为一个刚刚看过VB的老程序员,我有一个问题: 如何从另一个表单中打开一个表单?我不是说如何创建该表单的新实例,而是如何引用该表单?这样做了,如何从该表单获取数据? 您必须在某处存储对表单的默认实例的引用, 或为您的表单类实现Singleton设计模式以便轻松 访问默认实例。 我已经阅读了MS教程,但这是无意义的复杂;必须有一个简单,直接的方法,或者我只能假设MS在OO痴迷的荒谬之后摧毁了一个有用的工具(VB) As an old programmer just now looking at VB I have a question: How does one simply open one form from another ? I don''t mean how does one create a new instance of that form , but rather how to refer to THAT form ? And having done this, how does one get data to and from that form ? You''ll have to store references to your forms'' default instances somewhere, or implement the Singleton design pattern for your form classes for easily accessing the default instances. I have read the MS tutorial on this but it is senselessly complex; there must be a simple, straightforward method, or I can only assume that MS has destroyed a useful tool (VB) in the absurd following of the OO obsession

ACK。希望表单的默认实例将返回VB 2005. - Herfried K. Wagner [MVP] < URL:http://dotnet.mvps/>

ACK. Hopefully, default instances for forms will be back in VB 2005. -- Herfried K. Wagner [MVP] <URL:dotnet.mvps/>

" Herfried K. Wagner [ MVP] QUOT; <喜*************** @ gmx.at>写了 "Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote 确认。希望表单的默认实例将在VB 2005中返回。 ACK. Hopefully, default instances for forms will be back in VB 2005.

为什么要重新自动实例化表单?他们是许多问题的来源,包括我的应用程序不会关闭类型 的问题。重点是没有其他对象可以自动实例化 为什么要让表单采取这种方式? 恕我直言最好告诉开发人员如何添加该功能, 而不是将其包含在语言中。如果它们包含它,我们都必须使用它来支持,但如果有一个简单的解决方法可以将它带回来,那么那些想要它的人可以拥有它,而那些不会不会被认为是错误的可能来源。 这段代码不提供功能: 模块模块1 Public MyForm1 As New Form1 Public MyForm2 As New Form2 结束模块 如上所述,MyForm1和MyForm2都是自动实例化的。 恕我直言,这将是更好的解决方案。您怎么看? LFS

Why would you want auto-instantiating forms back? They were the source of many problems including ''My app won''t shut down'' type of problems. The main point is that no other objects are auto-instantiating so why make forms act that way? IMHO it would be better to tell the developer how to add that functionality, rather than have it included in the language. If they include it, we all have to live with it, but if there is a simple workaround to bring it back, then those who want it, can have it, while those who don''t won''t have to consider it a possible source for errors. Doesn''t this code provide that functionality: Module Module1 Public MyForm1 As New Form1 Public MyForm2 As New Form2 End Module With the above, both MyForm1 and MyForm2 are auto-instantiating. IMHO, That would be the better solution. What do you think? LFS

更多推荐

如何从另一个表单中打开一个表单?

本文发布于:2023-11-02 10:01:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1552083.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:表单

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!