bool报错 大家看看
我定义了一个方法但是bool报错 大家看看怎么回事
pivate bool ExistsMdiChildrenInstance(string MdiChildrenClassName)
{
foreach(Form childFrm in this.MdiChildren)
{
if(childFrm.Name==MdiChildrenClassName)
{
if(childFrm.WindowState==FormWindowState.Minimized)
{
childFrm.WindowState=FormWindowState.Maximized;
}
childFrm.Activate();
return true;
}
}
return false;
}
------最佳解决方案--------------------代码抄的?
把红色地方改下
private bool ExistsMdiChildrenInstance(string MdiChildrenClassName)
{
foreach(Form childFrm in this.MdiChildren)
{
if(childFrm.Name==MdiChildrenClassName)
{
if(childFrm.WindowState==FormWindowState.Minimized)
{
childFrm.WindowState=FormWindowState.Maximized;
}
childFrm.Activate();
return true;
}
}
return false;
}
------其他解决方案--------------------所有if对应的都需要有return ?