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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Object property values from within object?

Status
Not open for further replies.

drwunz

Programmer
Dec 17, 2001
34
US
Each component placed on a VB form gets a unique name and values for Top, Left, Width, Height, etc. How do I access those from within the activeX component? I need this to pass as a parameter to a database function.



 
Code within an ActiveX object is independent of the form it is on. Within the activeX, I can get to some of the properties (such as Width, Height) but not Name. The name I get back when trying that is the default, not what is assigned on the form on which it is placed...
 
Pass a reference to the activeX object of the parent form. ie.

in your active X object

mFormParent as form


Public Property Get ParentForm() As form
Set ParentForm= mFormParent
End Property

Public Property Set ParentForm(ByVal vNewValue As form)
Set mFormParent = vNewValue
End Property

when the form is loaded or otherwise, set the parent form property:

SET ObjActiveX.ParentForm = me

You should then be able to access all properties and methods on the parent form in your Active X object.


Hope this helps,

Chris Dukes
 
Thanks, cdukes, but I got the following error on the Get Property:
"Private object modules cannot be used in public object modules as parameters or return types for public procedures, as public data members, or as fields of public user defined types"
I'm building an OCX library of objects...they need to be public.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top