我这样在time_tick下这么写:
if (comm.IsOpen&&qitaselect.Substring(1, 1) == "1")////////////////////////////////////////////////需修改
{
Form12 form12 = new Form12();
form12.show();
if (zhuangtai2.Substring(6, 1) == "1")
{
}
else if (zhuangtai2.Substring(6, 1) == "0")
{
qitaselect = qitaselect.Substring(0, 1) + "0";
form12.Visible = false;
form12.Close();
}
}我利用中断模式调试,发现当zhuangtai2.Substring(6, 1) == "0"时:其下面的三句话: qitaselect = qitaselect.Substring(0, 1) + "0";
form12.Visible = false;
form12.Close();
都是执行了的,执行完后因总条件“qitaselect.Substring(1, 1) == "1"”不在符合就不会再来执行这段代码了;但是问题是:这样执行后(确认form12.Visible = false;form12.Close();)都是被执行过的,但窗口就是关不掉!!!!!form12.show()能打开窗口,但close()就是关不掉!!!!!!请问这是为什么
?????????????
if (comm.IsOpen&&qitaselect.Substring(1, 1) == "1")////////////////////////////////////////////////需修改
{
Form12 form12 = new Form12();
form12.show();
if (zhuangtai2.Substring(6, 1) == "1")
{
}
else if (zhuangtai2.Substring(6, 1) == "0")
{
qitaselect = qitaselect.Substring(0, 1) + "0";
form12.Visible = false;
form12.Close();
}
}我利用中断模式调试,发现当zhuangtai2.Substring(6, 1) == "0"时:其下面的三句话: qitaselect = qitaselect.Substring(0, 1) + "0";
form12.Visible = false;
form12.Close();
都是执行了的,执行完后因总条件“qitaselect.Substring(1, 1) == "1"”不在符合就不会再来执行这段代码了;但是问题是:这样执行后(确认form12.Visible = false;form12.Close();)都是被执行过的,但窗口就是关不掉!!!!!form12.show()能打开窗口,但close()就是关不掉!!!!!!请问这是为什么
?????????????
Process.GetCurrentProcess().Kill();
在time_tick下这么写:
if (comm.IsOpen&&qitaselect.Substring(1, 1) == "1")////////////////////////////////////////////////需修改
{
Form12 form12 = new Form12();
form12.show();
if (zhuangtai2.Substring(6, 1) == "1")
{
}
else if (zhuangtai2.Substring(6, 1) == "0")
{
time1.stop();
qitaselect = qitaselect.Substring(0, 1) + "0";
form12.Visible = false;
form12.Close();
}
}关掉了时钟,还是关不掉哪个窗口!这是为什么?