Hi, I have a collection of MDI forms, where there are different objects (Form1,Form2 etc). Is there any fast way how to compare whather selected form (using FOR cycle for iterating through form collection) is Form1,Form2..? Thank you!
+1
A:
Sounds like a straightforward thing to do, what is the actual problem you are facing?
Have you tried a regular compare?
foreach(Form f in AllForms) {
if(f == myForm1)
return true;
}
Use f == myForm1
if you already have a single instance of Form1
named myForm1
that you are comparing against or f is Form1
if you are looking for "any" Form1
, without already having one somewhere.
Tiberiu Ana
2009-11-04 12:44:35
f == Form1 ????? It won't even compile.
Alex Reitbort
2009-11-04 12:47:13