c# tabcontrol 点击不同的tabpage 触发不同的事件_官林辉_新浪博客

在tabcontrol1上有四个tabpage页,即tabPage1,tabPage2,tabPage3,tabPage4,我想点击tabPage3时,弹出一个窗体,进行相关的设置!开始不会,在网上搜点资料,就知道如何用了,和大家分享一下的!

    

      

private void tabControl1_SelectedIndexChanged(object sender,

EventArgs e)

      

{

          

if (tabControl1.SelectedTab ==

tabPage3)

          

{

              

SocialAnalysisSetup sas = new

SocialAnalysisSetup();//生成一个窗体对象

              

sas.Show();//显示窗体
              

string sql3 = “select 参数 from 参数表 where 值=1”;

              

conn.Open();

              

OleDbCommand cmd3 = new OleDbCommand(sql3, conn);

              

OleDbDataReader dr3 = cmd3.ExecuteReader();

              

while(dr3.Read())

              

{

                  

AnalysisName = dr3[“参数”].ToString();

              

}

              

conn.Close();

          

}

      

}

来源URL:http://blog.sina.com.cn/s/blog_5c5bc9070100tukr.html