Hi,

I have a Windows Form frmMain() holding seven more-or-less unrelated UserControls, "ucFlopsy", "ucMopsy", "ucCottontail", etc...

I say "more-or-less" because each of the seven UC has three similar public read/write properties:
IsLocked (a boolean indicating if the following two properties are "Locked")
IsLockedID (if IsLocked=True then IsLockedID is an integer)
IsLockedName (if IsLocked=True then IsLockedName is a string)
There are no other attributes common to the seven UC.

frmMain can easily read/write the three public properties of each UC (me.ucMopsy.IsLocked...), but frmMain doesn't care about these properties!

How does ucFlopsy access those public properties of ucMopsy?

I need code in ucFlopsy (something that works, and this doesn't!)

If ucMopsy.IsLocked then
   'whatever
Else
   'whatever else
End If

izy

I have an ugly workaround in place.

in ucFlopsy

Protected WithEvents oMopsy as ProjectXYZ.ucMopsy
Public WriteOnly Property referenceMopsy As ProjectXYZ.ucMopsy
        Set(ByVal value As ProjectXYZ.ucMopsy)
            oMopsy = value
        End Set
End Property

in frmMain Load

Me.ucFlopsy.referenceMopsy = Me.ucMopsy

it works, but it sure is ugly.

Anyone have a better suggestion?

izy

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.