Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Forms as members of a class?

0 views
Skip to first unread message

Gelpilot

unread,
Nov 26, 1997, 3:00:00 AM11/26/97
to

I've created a class which has its own form. I would like to reference the form
and the objects on the form as members of the class. How can I embed the form
or a reference to the form in the class?
George Lehmann
Horizon Business Concepts
geo...@hbcinc.com

Bob Butler

unread,
Nov 26, 1997, 3:00:00 AM11/26/97
to

Gelpilot <gelp...@aol.com> wrote in article
<19971126012...@ladder02.news.aol.com>...
How about:
Property Get TheForm() As Form
Set TheForm=frmClassForm
End Property

from your code you should be able to:
oMyClass.TheForm.<whatever>
Generally, exposing objects like this makes your code less encapsulated.
You should consider just adding properties and methods to the class to
operate on the form:
Property Let FormCaption(NewCaption As String)
frmClassForm.Caption=NewCaption
End Property
Public Sub ShowForm()
frmClassForm.Show
End Sub
<etc>


Gelpilot

unread,
Nov 28, 1997, 3:00:00 AM11/28/97
to

>How about:
>Property Get TheForm() As Form
> Set TheForm=frmClassForm
>End Property

I wan't sure of the syntax on how to do this, thanks

.>Generally, exposing objects like this makes your code less encapsulated.

>You should consider just adding properties and methods to the class to
>operate on the form:

I have done this to some extent, but the object I want to expose is a
commercial add-in with dozens of methods and properties, and I didn't feel like
re-inventing 55 different wheels on something that wouldn't be changing. I may
still do this to some degree...

0 new messages