Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Window Manager Class Question
Message
De
06/10/2008 18:24:19
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
MS SQL Server
Divers
Thread ID:
01353101
Message ID:
01353157
Vues:
32
Read my lips ... Interfaces!! =0)
public interface IFormForManager
{
    int iRecordKey {get;set;}
}
Each of your Forms that need to be controlled by your FormsManager will have to be changed to implement the IFormForManager interface.

Then, your class would would look like this:
public Form GetOpenForm(FormTypes type, int iRecordKey)
{
	Form oRetVal = null;

	foreach(IFormForManager oForm in oWindows)
	{
		if (oForm.iRecordKey == iRecordKey)
		{
		    oRetVal = oForm;
		}
	}
	return oRetVal;
}
~~Bonnie







>I have a window manager class. It maintains references to open User and Item forms:
>
>At the top I create an array list:
>
>
>private static ArrayList oWindows = new ArrayList();
>
>
>The I have a method to return an instance of a form in the collection:
>
>
>public void GetOpenForm(FormTypes type, int iRecordKey)
>{
>	form oRetVal = null;
>
>	foreach(form oForm in oWindows)
>	{
>		if (oForm.iRecordKey == iRecordKey)
>		{
>		}
>	}
>}
>
>
>Problem is, the references to oForm in the code above are not User or Item forms, so the iRecordkey reference fails to compile. Add to this, the Item and User forms are not based off any single base form.
>
>How do I make oForm "know" about iRecordKey?
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