C#windows程序中为什么form1_load函数中的代码还没有执行完,窗体就会显示出来
具体代码如下privatevoidForm1_Load(objectsender,EventArgse){//连接SQL数据库并调用数据到指定的datagridview中...
具体代码如下
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中的数据就没有加载,求指教!!! 展开
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中的数据就没有加载,求指教!!! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询