.net的winform程序
public Login()
{
InitializeComponent();
string strIP = GetIP().ToString();
con1.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = con1;
cmd.CommandText = "select * from CheckIP where ip='" + strIP + "'";
SqlDataAdapter sda = new SqlDataAdapter();
sda.SelectCommand = cmd;
cmd.ExecuteNonQuery();
DataSet ds = new DataSet();
sda.Fill(ds, "CheckIP");
con1.Close();
if (ds.Tables[0].Rows.Count != 0)
{
this.notifyIcon1.Visible = true;
this.Visible = false;
this.ShowInTaskbar = false;
usersName = ds.Tables[0].Rows[0]["userno"].ToString();
DoWork();
Timers();
}
else
{
this.userName.Focus(); //页面加载时获取焦点
this.notifyIcon1.Visible = false;
this.skinEngine1.SkinFile = "MSN.ssk"; //样式
this.Message1.Tag = 9999; //为label去掉加皮肤之后的样式
}
}
这是一个消息提示功能的加载部分,要想实现的功能是:先获取本机IP,去数据库查找,如果找到有这条记录,则可以自动登录,如果打不到记录,则出现登录界面。但现在的问题是,查找到这条记录后,登录成功,并且也出现登录界面了,感觉this.Visible = false; 这句话没起作用,就是登录界面不隐藏,请问高手这是怎么回事啊