Solved

Creating an activeX control and sending data to it

Posted on 2009-07-09
1
152 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

717 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