Click here to Skip to main content
15,913,303 members
Home / Discussions / C#
   

C#

 
QuestionWebservice to receive SOAP/XML data Pin
sirTachyon3-May-10 0:01
sirTachyon3-May-10 0:01 
QuestionUsing cards.dll in Windows 7 Pin
Mc_Topaz2-May-10 23:21
Mc_Topaz2-May-10 23:21 
AnswerRe: Using cards.dll in Windows 7 Pin
Ghydo2-May-10 23:38
Ghydo2-May-10 23:38 
GeneralRe: Using cards.dll in Windows 7 Pin
Mc_Topaz2-May-10 23:59
Mc_Topaz2-May-10 23:59 
QuestionHi! is it possible that my dbase is sql2005 using php and javascript Pin
crisjala2-May-10 23:11
crisjala2-May-10 23:11 
AnswerRe: Hi! is it possible that my dbase is sql2005 using php and javascript Pin
Michel Godfroid2-May-10 23:48
Michel Godfroid2-May-10 23:48 
Questiontypeof() ???? Pin
reza assar2-May-10 23:09
reza assar2-May-10 23:09 
AnswerRe: typeof() ???? [modified] Pin
#realJSOP2-May-10 23:47
professional#realJSOP2-May-10 23:47 
It's because of your return type.

You should just return the child form that you found, and cast it to the desired type in the calling method.

You may also have to fully qualify the type you're passing in (MyApp.MyAppChildForm instead of just MyAppChildForm).

MyApp.MyAppChildForm child = FindChildOfType(MyApp.MyAppChildForm);
if (child != null)
{
    // do something with child form

}

private Form FindChildOfType(Type formType)
{
    foreach (Form child in this.MdiChildren)
    {
        if (child.GetType() == formType)
        {
            return child;
        }
        return null;
    }
}


BTW, in the code snippet I posted, I changed the variable names in your Find method to something more appropriate.

EDIT - I changed the name of the method I posted to match the call the code was making... (slaps forehead)
.45 ACP - because shooting twice is just silly
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

modified on Monday, May 3, 2010 12:46 PM

GeneralRe: typeof() ???? Pin
reza assar4-May-10 23:26
reza assar4-May-10 23:26 
AnswerRe: typeof() ???? Pin
PIEBALDconsult3-May-10 4:34
mvePIEBALDconsult3-May-10 4:34 
GeneralRe: typeof() ???? Pin
reza assar4-May-10 23:31
reza assar4-May-10 23:31 
GeneralRe: typeof() ???? Pin
PIEBALDconsult5-May-10 4:13
mvePIEBALDconsult5-May-10 4:13 
QuestionNew Project Ideas? Pin
CoderForEver2-May-10 19:56
CoderForEver2-May-10 19:56 
AnswerRe: New Project Ideas? Pin
Pete O'Hanlon2-May-10 20:42
mvePete O'Hanlon2-May-10 20:42 
GeneralRe: New Project Ideas? Pin
Roger Wright2-May-10 21:11
professionalRoger Wright2-May-10 21:11 
JokeRe: New Project Ideas? Pin
Michel Godfroid2-May-10 22:48
Michel Godfroid2-May-10 22:48 
GeneralRe: New Project Ideas? Pin
MollyTheCoder3-May-10 4:43
MollyTheCoder3-May-10 4:43 
AnswerRe: New Project Ideas? [modified] Pin
wangbo02392-May-10 20:50
wangbo02392-May-10 20:50 
GeneralRe: New Project Ideas? Pin
Pete O'Hanlon2-May-10 20:54
mvePete O'Hanlon2-May-10 20:54 
GeneralRe: New Project Ideas? Pin
Roger Wright2-May-10 21:12
professionalRoger Wright2-May-10 21:12 
GeneralRe: New Project Ideas? Pin
wangbo02392-May-10 23:17
wangbo02392-May-10 23:17 
AnswerRe: New Project Ideas? Pin
Roger Wright2-May-10 21:08
professionalRoger Wright2-May-10 21:08 
GeneralRe: New Project Ideas? Pin
Pete O'Hanlon2-May-10 21:17
mvePete O'Hanlon2-May-10 21:17 
GeneralRe: New Project Ideas? Pin
Roger Wright3-May-10 9:06
professionalRoger Wright3-May-10 9:06 
GeneralRe: New Project Ideas? Pin
CoderForEver3-May-10 19:54
CoderForEver3-May-10 19:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.