Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Custom Base Form Class
Message
De
08/08/2007 15:00:08
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Conception classe
Titre:
Custom Base Form Class
Versions des environnements
Environment:
VB 8.0
Divers
Thread ID:
01246867
Message ID:
01246867
Vues:
69
I created a custom Base Form class, and I am trying to add logic in the constructor to append a string to the forms Text property based on a string in App.Config. I can make this work, but when I try to edit the derived form in VS in Design View I get an error indicating that it can't find the config file, which means that when a form is opened in Design view, it fires the constructor method. Is this correct, and if so, how can I do this without getting the error. Here is the Base Form class:
    <CLSCompliant(True)> _
    Public Class RAFForm
        Inherits System.Windows.Forms.Form

        Public Sub New()

            MyBase.New()

            If AppEnvironment.CurrentEnvironment <> AppEnvironment.Environment.PRODUCTION Then
                MyBase.Text = String.Concat(MyBase.Text, " (", AppEnvironment.CurrentEnvironment.ToString, ")")
            End If

        End Sub

    End Class
The CurrentEnvironment method of the AppEnvironment class is a static method that reads from the config file and returns what environment is current set.
Very fitting: http://xkcd.com/386/
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform