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.comwww.prenia.comWeblog: blogs.prenia.com/cathi