Click here to Skip to main content
15,897,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey all
i'm using c# ,i want to call forms in loop i try the following
for (int i = 0; i <= 5; i++)
            {
                if (dty[i] == smthing)
                {
                    
                    checkingdisease cse = new checkingdisease();
                    
                    cse.Show();
                    
                }
            }

but it displays all forms meaning 5 forms ;
how can i correct to display only one form and after doing some operation on thatform the next form will be displayed;
helppppp!!!!!!!!!!!!!!
Posted
Updated 8-Jun-10 10:22am
v2
Comments
Toli Cuturicu 8-Jun-10 16:24pm    
"helppppp!!!!!!!!!!!!!!" is preposterous.
"help!" is decent, but not really necessary. Everybody knows that you need help. That's why you posted here, isn't it?

Instead of showing individual forms, why don't you just show a tab control that contains one tab for each disease?
 
Share this answer
 
You could also considre using a wizard-style form that makes the user proceed through a specific set of forms one at a time.

Here's a link to an article here on CodeProject:

Wizard Form Implementation[^]
 
Share this answer
 
Istead of the Show() method call the ShowDialog() one, as in the code snippet below:

C#
for (int i = 0; i <= 5; i++)
{
    if (dty[i] == smthing)
    {
        checkingdisease cse = new checkingdisease();
        cse.ShowDialog();
    }
}
 
Share this answer
 
thanks!
but i want to display the 2nd form depending on condition (operation) of the first may be not displayed if condition unsuccessful and cont... like this
 
Share this answer
 
Comments
Dylan Morley 8-Jun-10 10:56am    
Sauro Vitis' answer will work for you, but I'd really consider using one of the appoaches John has linked for you (I'd favour the Wizard implementation). Creating lots of forms in a loop is horrible!
Toli Cuturicu 8-Jun-10 16:24pm    
Reason for my vote of 1
fake answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900