Solved

Creating an activeX control and sending data to it

Posted on 2009-07-09
1
145 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
ID: 24815477
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

919 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

17 Experts available now in Live!

Get 1:1 Help Now