mardi 31 mars 2015

Dynamic Windows Form Initialization

I am trying to write a program in C# that dynamically initializes a set of windows forms.


It's a tournament program that allows the user to manage multiple stations at once.


So, the best I've come up with is something like, say, the user wants to manage three stations.



TournamentForm[] T = new TournamentForm[3];

void startTournament()
{
for (int count = 0; count < t.length; count++)
{
T[count] = new TournamentForm();
T[count].show();
}
}


The inherent problem with this approach is that at the end of each loop, the form is closed.


Is there a means of dynamically initializing windows forms, or do I have to long code a maximum number of windows instances?




Hmm... I may have had an idea using recursion while writing this. Still posting the question in case there's a better answer.


Aucun commentaire:

Enregistrer un commentaire