Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set object property

Status
Not open for further replies.

JTBorton

Technical User
Jun 9, 2008
345
DE
Ok I'm trying to migrate to vb.net 2010 from Excel VBA. I'm trying create a parent property for my user form so that it can identify which form called it into existence. Here is how I did it in VBA:

Code:
Private frmParent As MSForms.UserForm

Public Property Get ParentForm() As MSForms.UserForm
    Set ParentForm = frmParent
End Property
Public Property Let ParentForm(ByRef Parent As MSForms.UserForm)
    Set frmParent = Parent
End Property

I tried to do this in VB2010 as follows,

Code:
Private frmParent As Form

Public Property Parent As Form
    Get
        Return frmParent   <--- VB didn't like this at all
    End Get
    Set(ByVal value As Form)
        SetAttr()   <--- Won't let me Set the object
    End Set
End Property

Can someone give me a boost in the right direction?

-Joshua
Well, You can try banging your head against the wall, but you just end up with lost-time injuries and damaged equipment. [M. Passman]
 
The below code worked fine for me...
Code:
Private frmParent As Form

    Public Property Parent() As Form
        Get
            Return frmParent   '<--- VB didn't like this at all    
        End Get
        Set(ByVal value As Form)
            frmParent = value   '<--- Won't let me Set the object    
        End Set
    End Property
Regards

Andy
---------------------------------
Zebracorn: 50% Zebra, 50% Unicorn = 100% Real.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top