Utiliser une class statique
Bonjour tout le monde,
Je tentes de compiler un projet que je viens de convertir de VS2003 à VS2008. Je ne sais pas si le projet fonctionnait sur VS2003 mais je bloque sur une classe statique que voici
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| public class GlobalHelper
{
public static Servers dbServers = new Servers();
public static Groups dbGroups = new Groups();
public static ApplicationSettings appSettings = new ApplicationSettings();
public static ControlHideShow controlHideShow = new ControlHideShow();
public static Form[] MDIChildrens;
public static LiveInformationBox.InfoWindow infoWin = new LiveInformationBox.InfoWindow(
System.IO.Path.Combine(Application.StartupPath, "XMLInfoFile.xml"),
LiveInformationBox.InfoWindow.WindowPositions.BOTTOM_RIGHT
);
public static void PopulateGroupsDropDown(ComboBox cb, string selected_text)
{
(...)
}
} |
Le programme léve une exception sur
Code:
GlobalHelper.controlHideShow.Enable = false;
L'erreur est:
Citation:
Une exception a été levée par l'initialiseur de type pour 'MultiRemoteDesktopClient.GlobalHelper'.
En débug, la variable GlobalHelper.controlHideShow est à Null et le constructeur de GlobalHelper.controlHideShow n'est jamais appelé. J'ai tenté de faire un GlobalHelper.controlHideShow = new ControlHideShow(); mais j'ai la même erreur sur cette ligne.
Quelqu'un peut me dire comment raisoudre le problème ?
Merci beaucoup d'avance