什么是启动表单构造函数 [英] What is startup form constructor

查看:125
本文介绍了什么是启动表单构造函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我需要将以下代码放入启动表单的构造函数中.

Hi,
I need to put following code in the Constructor of my startup form.

JohnKenedy.BusinessSQLEXPRInstaller _ins = new JohnKenedy.BusinessSQLEXPRInstaller("<Installation Display Name>", "localhost", "<New database instance name>", "<new database name>", "<database password>", "<database backup filename>");
if (_ins.IsDone == false) _ins.ShowDialog();
if (_ins.IsRestart == true)
{
Application.Exit();
this.Close();
return;
}



但是我真的不知道构造函数是什么以及如何访问它?
有什么帮助吗?谢谢



But I really donot know what the Constructor is and how to access it?
Any help? Thanks

推荐答案



您应该看一下: http://msdn.microsoft.com/zh-cn/library/ms173115.aspx [ ^ ]

创建类或结构时,将调用其构造函数.构造函数与类或结构具有相同的名称,通常会初始化新对象的数据成员."

示例(在这种情况下,构造函数为public Taxi())
Hi,

You should take a look at this: http://msdn.microsoft.com/en-us/library/ms173115.aspx[^]

"When a class or struct is created, its constructor is called. Constructors have the same name as the class or struct, and usually initialize the data members of the new object."

Example (in this case the constructor is public Taxi())
public class Taxi
{
    public bool isInitialized;
    public Taxi()
    {
        isInitialized = true;
    }
}



也可以查看以下内容: http://www.codeguru.com/forum/archive /index.php/t-413175.html [ ^ ]

希望对您有所帮助.



Also have a look at this: http://www.codeguru.com/forum/archive/index.php/t-413175.html[^]

Hope it helps.


这篇关于什么是启动表单构造函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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