Monday, May 27, 2013

int arry check for all odd or even??

All returns a Boolean result so you could use it in an if statement.



if (Test.All(i => (i % 2) == 0) || Test.All(i => (i % 2) > 0))
{
//all odd or even so do stuff
}
else
{
//mixed so do stuff
}


close all open forms that formBorderStyle is None

Hi


I wanna close all of the open forms but their BorderStyle property is None so the below code don't work for this issue. which code should I use instead?!



foreach (Form f in Application.OpenForms)
{
if (f.Name != "frmMain")
{
f.Close();
break;
}
}





امیدوارم همیشه بروز باشید I hope always be up2date


close all open forms that formBorderStyle is None


foreach (var i=Application.OpenForms.Count-1;i>=0;i--)
{
var f= Application.OpenForms[i];
if (f.Name != "frmMain")
{
f.Close();
break;
}
}





Muthukrishnan Ramasamy

net4.rmkrishnan.net

Use only what you need, Reduce global warming



close all open forms that formBorderStyle is None

I have error on the foreach line


امیدوارم همیشه بروز باشید I hope always be up2date


close all open forms that formBorderStyle is None

Missed to change foreach to for



for(var i=Application.OpenForms.Count-1;i>=0;i--)
{
var f= Application.OpenForms[i];
if (f.Name != "frmMain")
{
f.Close();
break;
}
}





Muthukrishnan Ramasamy

net4.rmkrishnan.net

Use only what you need, Reduce global warming


close all open forms that formBorderStyle is None

don't work. this code just can use for simple forms. but my forms are None in borderStyle property


امیدوارم همیشه بروز باشید I hope always be up2date


close all open forms that formBorderStyle is None


for (var i = Application.OpenForms.Count - 1; i >= 0;i-- )
{
var f = Application.OpenForms[i];
if (f.Name != "frmMain" && f.FormBorderStyle == System.Windows.Forms.FormBorderStyle.None)
{
f.Close();
//break;
}
}





Muthukrishnan Ramasamy

net4.rmkrishnan.net

Use only what you need, Reduce global warming