C#windows程序中为什么form1_load函数中的代码还没有执行完,窗体就会显示出来

具体代码如下
private void Form1_Load(object sender, EventArgs e)
{
//连接SQL数据库并调用数据到指定的datagridview中
this.BasSet.DataSource = link.SelectDataBase("select *from [BasSet$]");
this.Site_Inf.DataSource = link.SelectDataBase("select *from [Site_Inf$]");
this.Rir_ZV.DataSource = link.SelectDataBase("select *from [Rir_ZV$]");
this.Rir_ZQ.DataSource = link.SelectDataBase("select *from [Rir_ZQ$]");
this.洪水1931.DataSource = link.SelectDataBase("select *from ['1931$']");
this.洪水1935.DataSource = link.SelectDataBase("select *from ['1935$']");
this.洪水1954.DataSource = link.SelectDataBase("select *from ['1954$']");
this.洪水1968.DataSource = link.SelectDataBase("select *from ['1968$']");
this.洪水1969.DataSource = link.SelectDataBase("select *from ['1969$']");
this.洪水1980.DataSource = link.SelectDataBase("select *from ['1980$']");
this.洪水1983.DataSource = link.SelectDataBase("select *from ['1983$']");
this.洪水1988.DataSource = link.SelectDataBase("select *from ['1988$']");
this.洪水1996.DataSource = link.SelectDataBase("select *from ['1996$']");
this.洪水1998.DataSource = link.SelectDataBase("select *from ['1998$']");
INI_BasicDAT();
int i;
string[] aStr = new string[Iflood + 2];
aStr[0] = "预报洪水";
for (i = 1; i <= Flood.N; i++)
{
aStr[i] = Flood.Name[i - 1];
}
IniComboBox(cbbNoFloodINF, aStr, Flood.N + 1);
if (Flood.N >= 1)
{
cbbNoFloodINF.SelectedIndex = 1;
}
IniComboBox(cbbIncmINF, Increm.Name, Increm.N);
cbbIncmINF.SelectedIndex = 1;
IniChkListBox(chklstSiteINF, Sit1.Name, Sit1.N, 0);
for ( i = 0; i < Sit1.N; i++)
{
chklstSiteINF.SetItemChecked(i, true);
}
//不缩放
cbbProbINF.SelectedIndex = 8;
}
--------------------------------------------------------------------------------
在执行到IniChkListBox(chklstSiteINF, Sit1.Name, Sit1.N, 0);这一句的时候窗体就显示出来了,后面的代码还没有执行,所有ChkListBox中的数据就没有加载,求指教!!!

出现错误(Exception)了,根据错误的种类,有的就是这样跳过之后的代码直接显示窗体,有的是窗体都不显示。

IniChkListBox 方法里有问题
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答