我有一个构造函数:c#先执行构造函数还是onLoad?
public Form1(string startDate, string endDate, string cbQCValues,string cbAnalytes, string cbInstruments,bool copy_of_form)
{
InitializeComponent();
dateStart.Value = Convert.ToDateTime(startDate);
dateEnd.Value = Convert.ToDateTime(endDate);
GenerateGraph();
}
,我也有一个onload
private void Form1_Load(object sender, EventArgs e)
{
string qcvalues_query = "SELECT DISTINCT name FROM qvalues ORDER by name";
string analytes_query = "SELECT DISTINCT compound FROM qvalues ORDER by compound";
string instruments_query = "SELECT DISTINCT instrument FROM batchinfo WHERE instrument <> '' AND instrument is not Null ORDER by instrument";
...
...
}
什么最先被执行?我需要确保onLoad首先被执行
这是可行的吗?
可能重复[什么设置代码应该在窗体构造函数与表单加载事件?](http://stackoverflow.com/questions/2521322/what-setup-code-should-go-in-form-constructors-对形式加载事件) – 2016-05-11 13:53:20