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

C#

 
AnswerRe: How many instances do I have in the following example? Pin
Pete O'Hanlon12-Dec-06 3:21
mvePete O'Hanlon12-Dec-06 3:21 
GeneralRe: How many instances do I have in the following example? Pin
Shy Agam12-Dec-06 3:28
Shy Agam12-Dec-06 3:28 
GeneralRe: How many instances do I have in the following example? Pin
Pete O'Hanlon12-Dec-06 3:44
mvePete O'Hanlon12-Dec-06 3:44 
Questionautoscroll property of an MDI Pin
sathishtl00712-Dec-06 1:36
sathishtl00712-Dec-06 1:36 
AnswerRe: autoscroll property of an MDI Pin
stancrm12-Dec-06 1:53
stancrm12-Dec-06 1:53 
GeneralRe: autoscroll property of an MDI Pin
sathishtl00712-Dec-06 2:08
sathishtl00712-Dec-06 2:08 
GeneralRe: autoscroll property of an MDI Pin
Pete O'Hanlon12-Dec-06 2:32
mvePete O'Hanlon12-Dec-06 2:32 
QuestionHow to pass a form name to a sub program Pin
mwith12-Dec-06 1:32
mwith12-Dec-06 1:32 
Hi All,
I am new to C# and OOP. I refered a article about Single instance child for in MDIhttp://www.codeproject.com/csharp/single_instance.asp?df=100&forumid=51798&select=1394073#xx1394073xx[^])

I tried to write a sub program to stop that code duplication as follows

private void frmLoad(Form frmNew)<br />
        {<br />
            Form[] charr = this.MdiChildren;<br />
            if (charr.Length == 0)      // no child form is opened<br />
            {<br />
                frmNew sus = new frmNew();<br />
                sus.MdiParent = this;<br />
                sus.StartPosition = FormStartPosition.Manual;<br />
                sus.Location = new Point(0, 0);<br />
                sus.Show();<br />
            }<br />
            else      // child forms are opened<br />
            {<br />
                int count = 0;<br />
                foreach (Form chform in charr)<br />
                {<br />
                    if (chform.Name == "frmNew")// one instance of the form is opened<br />
                    {<br />
                        chform.Activate();<br />
                        count = 0;<br />
                        break;   // exit loop<br />
                    }<br />
                    else<br />
                        count++;<br />
                }<br />
                if (count > 0)<br />
                {<br />
                    frmNew sus = new frmNew();<br />
                    sus.MdiParent = this;<br />
                    sus.StartPosition = FormStartPosition.Manual;<br />
                    sus.Location = new Point(0, 0);<br />
                    sus.Show();<br />
                }<br />
<br />
            }<br />
        }



I want to pass a form name as a argument. what is wrong with this?

Please can anybody help me?Cry | :((

mWith
AnswerRe: How to pass a form name to a sub program Pin
stancrm12-Dec-06 1:49
stancrm12-Dec-06 1:49 
Questionone port for many clients Or many ports for each client ? Pin
MarkPhB12-Dec-06 1:25
MarkPhB12-Dec-06 1:25 
AnswerRe: one port for many clients Or many ports for each client ? Pin
stancrm12-Dec-06 1:32
stancrm12-Dec-06 1:32 
GeneralRe: one port for many clients Or many ports for each client ? Pin
MarkPhB12-Dec-06 4:48
MarkPhB12-Dec-06 4:48 
QuestionUrgent - Need help with Hangman Game Pin
China-Gary12-Dec-06 1:20
China-Gary12-Dec-06 1:20 
AnswerRe: Urgent - Need help with Hangman Game Pin
stancrm12-Dec-06 1:28
stancrm12-Dec-06 1:28 
GeneralRe: Urgent - Need help with Hangman Game Pin
quiteSmart12-Dec-06 1:42
quiteSmart12-Dec-06 1:42 
AnswerRe: Urgent - Need help with Hangman Game Pin
ednrgc12-Dec-06 2:15
ednrgc12-Dec-06 2:15 
GeneralRe: Urgent - Need help with Hangman Game Pin
China-Gary12-Dec-06 2:17
China-Gary12-Dec-06 2:17 
GeneralRe: Urgent - Need help with Hangman Game Pin
ednrgc12-Dec-06 2:27
ednrgc12-Dec-06 2:27 
GeneralRe: Urgent - Need help with Hangman Game Pin
China-Gary12-Dec-06 2:32
China-Gary12-Dec-06 2:32 
AnswerRe: Urgent - Need help with Hangman Game Pin
Colin Angus Mackay12-Dec-06 2:31
Colin Angus Mackay12-Dec-06 2:31 
Questionurgent!!! Pin
chravisankar12-Dec-06 1:14
chravisankar12-Dec-06 1:14 
GeneralRe: urgent!!! Pin
quiteSmart12-Dec-06 1:33
quiteSmart12-Dec-06 1:33 
AnswerRe: urgent!!! Pin
stancrm12-Dec-06 1:34
stancrm12-Dec-06 1:34 
GeneralRe: urgent!!! Pin
karam chandrabose12-Dec-06 1:59
karam chandrabose12-Dec-06 1:59 
GeneralRe: urgent!!! Pin
Colin Angus Mackay12-Dec-06 2:46
Colin Angus Mackay12-Dec-06 2:46 

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.