禁用“默认实例"在 VB 2010 [英] Disable "default instance" in VB 2010
本文介绍了禁用“默认实例"在 VB 2010的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经开始在 VB 2010 中做一些基本的 win 表单工作,但我真的被默认实例所困扰特征.有没有办法可以完全禁用它而只像普通类一样使用类?
I've started doing some basic win forms work in VB 2010 and I'm really bothered by the default instance feature. Is there a way I can disable it entirely and just use the classes like ordinary classes?
推荐答案
向窗体的构造函数添加参数.这将阻止创建默认实例.您需要调用 InitializeComponent 来布局控件.
Add a parameter to the form's constructor. That will prevent the default instance being created. You will need to have a call to InitializeComponent to layout the controls.
Sub New(junk As Object)
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
End Sub
这篇关于禁用“默认实例"在 VB 2010的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文