Solved

Creating an activeX control and sending data to it

Posted on 2009-07-09
1
148 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

791 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