Darin
Thu Sep 11 16:39:53 CDT 2003
Thanks, I figured it out - I was being lazy.
"Jay B. Harlow [MVP - Outlook]" <Jay_Harlow@email.msn.com> wrote in message
news:eqnaGxKeDHA.3096@TK2MSFTNGP11.phx.gbl...
> Darin,
> I rarely use C#, its 'easy' enough to translate between the two. I usually
> have problems with the property syntax, luckily VS.NET I can use the Class
> View to add property methods.
>
> Not promising anything, if I get time later I will translate it. The
> following section of MSDN identifies the differences between the two
> languages.
>
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/html/vxgrfLanguageEquivalents.asp
>
> Hope this helps
> Jay
>
> "Darin" <test@yahoo.com> wrote in message
> news:%23mGsJ9JeDHA.392@TK2MSFTNGP12.phx.gbl...
> > Do you have an example in C# code?
> >
> > Thanks
> >
> > "Jay B. Harlow [MVP - Outlook]" <Jay_Harlow@email.msn.com> wrote in
> message
> > news:%23X1NIl%23dDHA.1712@TK2MSFTNGP09.phx.gbl...
> > > Darin,
> > > > However, I thought
> > > > maybe I could use a singleton approach to each child form. Is this
> > > > possible? Any better ideas?
> > >
> > > I would use the Singleton Pattern for each child, with a handler for
> > closing
> > > the form.
> > >
> > > Something like:
> > >
> > > Public Class MdiChildForm
> > > Inherits Form
> > >
> > > #Region " Singleton Pattern support "
> > >
> > > Private Shared m_instance as MdiChildForm
> > >
> > > Public Shared Readonly Property Instance() As MdiChildForm
> > > Get
> > > If m_instance Is Nothing Then
> > > m_instance = New MdiChildForm()
> > > End If
> > > Return m_instance
> > > End Get
> > > End Property
> > >
> > > #End Region
> > >
> > > Private Sub New()
> > > End Sub
> > >
> > > Protected Overrides Sub OnClosed(ByVal e As EventArgs)
> > > MyBase.OnClosed()
> > > m_instance = Nothing
> > > End Sub
> > >
> > > End Class
> > >
> > > This way the form is created when you first time you refer to the
> Instance
> > > property, if you close the form the instance field is cleared, forcing
> the
> > > form to be recreated if you refer to it again.
> > >
> > > Then I would use MidChildForm.Instance every place else I needed to
> refer
> > to
> > > this form.
> > >
> > > Alternatively you can handle the Closing event and prevent the form
from
> > > being closed (hide it instead). Not sure what effect this will have on
> > > application shut down.
> > >
> > > Hope this helps
> > > Jay
> > >
> > > "Darin" <test@yahoo.com> wrote in message
> > > news:uSX8Mc%23dDHA.1836@TK2MSFTNGP09.phx.gbl...
> > > > Hi,
> > > >
> > > > I am creating a MDI app that will be different from the typical mdi
> app
> > > (MS
> > > > Word...) The parent form will be the container for 5 different
child
> > > forms
> > > > that can be only created once (intialized). I have noticed that you
> can
> > > > create many instances of each child form. I do not want this
> > > functionality.
> > > > I was wondering what is the best way to not allow multiple instances
> of
> > > each
> > > > child form. I understand I could create a collection that could
keep
> > > track
> > > > and code it to look for that form in the collection. However, I
> thought
> > > > maybe I could use a singleton approach to each child form. Is this
> > > > possible? Any better ideas?
> > > >
> > > > Thanks in advance
> > > >
> > > >
> > >
> > >
> >
> >
>
>