本文介绍了如何在不飞溅的情况下停止表格5秒钟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好
我有一个形式,如飞溅(我不想飞溅)
我希望此表单显示5秒钟,然后在下面的语句中执行
然后基于结果,显示两种形式之一或如果不存在连接,则关闭应用程序
hi all
i have a form like splash (i dont want splash)
i want this form show for 5 second and then execute below statement
then Based on result , show one of two forms or if connection not exists close application
try
{
SqlConnection MySqlConnection = new SqlConnection(ConnectionMain.strconnection);
SqlCommand MySqlCommand = MySqlConnection.CreateCommand();
MySqlCommand.CommandText = "FormSelector";
MySqlCommand.CommandType = CommandType.StoredProcedure;
SqlParameter returnValue = new SqlParameter("returnVal", SqlDbType.Int);
returnValue.Direction = ParameterDirection.ReturnValue;
MySqlCommand.Parameters.Add(returnValue);
if (MySqlConnection.State != ConnectionState.Open)
{
MySqlConnection.Open();
}
MySqlCommand.ExecuteNonQuery();
int result = Convert.ToInt32(returnValue.Value);
if (MySqlConnection.State != ConnectionState.Closed)
{
MySqlConnection.Close();
}
if (result == 1)
{
this.Hide();
login frm_login = new login();
frm_login.ShowDialog();
this.Close();
}
else if (result == 2)
{
this.Hide();
main frm_main = new main();
frm_main.ShowDialog();
this.Close();
}
}
catch (Exception error)
{
DialogResult dr = MessageBoxFarsi.Show("Connection Error");
Application.Exit();
}
请帮助我
非常感谢
Please Help Me
Thanks A Lot
推荐答案
System.Threading.Thread.Sleep(50000);
这篇关于如何在不飞溅的情况下停止表格5秒钟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!