Solved

Creating an activeX control and sending data to it

Posted on 2009-07-09
1
144 Views
Last Modified: 2012-05-07
I am creating my own vb6 activeX control for use in my own VB6 exe.  I have most of it working, but I cant figure out how to send data to my activeX.

How do I set it up so my activeX can be send data from the vb6 program?  I want to be able to type MyControl.Address = 10.0.0.1 and then in the activeX control there would be a variable called address I would use.
0
Comment
Question by:Tom_Hickerson
1 Comment
 
LVL 16

Accepted Solution

by:
HooKooDooKu earned 500 total points
Comment Utility
To be able to use the syntax you show, you have to define a 'Property" for the ActiveX control.

I don't know if it is different in .NET, but in VB6, all you had to do was define a pair of matching Get and Let properties if you wanted to be able to read and write the address value (or just Get to only read or just Let to only set)

Basically, you need something like the following Snippet in the CTL file of you ActiveX control.  (Note, if the property is passing an Object rather than a built in variable type, replace 'Let' with 'Set' and prefix the A=B statements with 'Set')
Private m_Address as String
 

Public Property Let Address(Value as String)

  m_Address = Value

End Property

Public Property Get Address() as String

  Address = m_Value

End Property
 

Public Property Set SomeObj(Obj as Object)

  Set m_Obj = Obj

End Property

Public Property Get SomeObj() as Object

  Set SomeObj = m_Obj

End Property

Open in new window

0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now