Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to control...
Message
 
À
22/11/2003 07:10:56
Larry Santos
Local Data System
Philippines
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Divers
Thread ID:
00778326
Message ID:
00852850
Vues:
18
Larry,

No you won't have to do this. The garbage collection handles the disposing of the objects.

>Hello,
>
>should i have to commit the
>MyBase.Dispose(disposing)
>inside the
>
>Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
>?
>
>
>TIA
>>Larry,
>>
>>Inside the "Private Sub New(parent As Form)" constuctor, add the following:
>>
>>
>>Me.MdiParent = parent
>>
>>
>>
>>>Hello,
>>>
>>>How to make mdi and child form for this code?
>>>
>>>TIA
>>>
>>>>Larry,
>>>>
>>>>I ran the code through a converter and here are the results:
>>>>
>>>>
>>>>Class frmClients
>>>>   Private Shared m_instance As frmClients
>>>>
>>>>   Shared Function Instance(parent As Form) As frmClients
>>>>      If m_instance Is Nothing Then
>>>>         m_instance = New frmClients(parent)
>>>>      End If
>>>>      Return m_instance
>>>>   End Function 'Instance
>>>>
>>>>   Private Sub New(parent As Form)
>>>>      ...
>>>>   End Sub 'New
>>>>End Class 'frmClients '
>>>>
>>>>
>>>>Then elsewhere in your code to call the form
>>>>
>>>>frmClient.Instance(this).Show
>>>>
>>>>
>>>>
>>>>>Hi,
>>>>>im using VB.NET im not familiar in CS
>>>>>
>>>>>TIA
>>>>>
>>>>>>Larry,
>>>>>>
>>>>>>One approach is to use the Singleton design pattern. Here is a link to an article that describes this:
>>>>>>
>>>>>>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/singletondespatt.asp
>>>>>>
>>>>>>Here is an example about how to limit your form to only one instance:
>>>>>>
>>>>>>1. Make the constructor of your form private.
>>>>>>2. Add a private static variable to your form, that is the type of your form.
>>>>>>3. Add a public static read-only property to your form that is the type of your form.
>>>>>>4. In the get method of this property, if the static variable is null, create a new instance of the form. Then return the static variable.
>>>>>>
>>>>>>Instead of a property, you can use a function.
>>>>>>
>>>>>>
>>>>>>class frmClients
>>>>>>{
>>>>>>#Region " Singleton Pattern "
>>>>>>    static frmClients m_instance;
>>>>>>    static frmClients Instance(Form parent)
>>>>>>    {
>>>>>>        if (m_instance == null)
>>>>>>            m_instance = new frmClients(parent);
>>>>>>        return m_instance;
>>>>>>    }
>>>>>>    private frmClients(Form parent)
>>>>>>    {
>>>>>>        ...
>>>>>>    }
>>>>>>#End Region
>>>>>>}
>>>>>>
>>>>>>
>>>>>>Then elsewhere in your code to call the form
>>>>>>
>>>>>>frmClient.Instance(this).Show;
>>>>>>
>>>>>>
>>>>>>IMPORTANT: Handle either the Closed or Closing event of frmClients by setting m_instance to null in Closed.
>>>>>>
>>>>>>
>>>>>>>Hi,
>>>>>>>
>>>>>>>I have mdi form and inside of the mdi form i have menu name "Form1" when i click the menu "Form1" the child form1 will popup as a child..but when i again the menu "Form1" the child form1 will popup again..
>>>>>>>
>>>>>>>how to control the form1 child to activate only once and detect if they are still activated...
>>>>>>>
>>>>>>>TIA
>>>>>>>
>>>>>>>Larry Santos
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform