Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Window Manager Class Question
Message
De
30/06/2005 21:12:46
 
Information générale
Forum:
ASP.NET
Catégorie:
Conception classe
Divers
Thread ID:
01023603
Message ID:
01028001
Vues:
21
Kevin,

Why don't you open the form first, and pass the form into your class. Otherwise, you'd have to use reflection.

So, you'd call your manager class like this:
MyForm oForm = new MyForm();
oWinMgr.OpenForm(oForm);
And your WinMgr code would then be:
	public class WinMgr
	{
		// Count of windows open
		int iWinCount = 0;

		// Array to hold window instances
		object[] Windows;

		public void OpenForm(Form oForm)
		{
			
			// Increment the window count
			iWinCount++;

			// Resize the array to hold the new form instance
			Windows = new object[iWinCount];
			
			// Store the instance of the form to the array
			Windows[iWinCount] = oForm;

			// Display the form
			oForm.Show();
		}
	}
That should work.

~~Bonnie




>I am working on this code. The OpenForm method receives
>the name of the form class to open.
>
>How do I change this line to open the desired form:
>
>MyForm oForm = new MyForm();	
>
>
>I nedd to change the word 'MyForm' to whatever name
>was passed in.
>
>
>	public class WinMgr
>	{
>		// Count of windows open
>		int iWinCount = 0;
>
>		// Array to hold window instances
>		object[] Windows;
>
>		public void OpenForm(string sFormName)
>		{
>			
>			// Increment the window count
>			iWinCount++;
>
>			MyForm oForm = new MyForm();	
>
>			// Resize the array to hold the new form instance
>			Windows = new object[iWinCount];
>			
>			// Store the instance of the form to the array
>			Windows[iWinCount] = oForm;
>
>			// Display the form
>			oForm.Show();
>
>		}
>	
>	}
>
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform