Solved

ActiveX Control Problem

Posted on 2002-04-12
5
148 Views
Last Modified: 2010-05-02
hallo,

i have a big problem with an activex control and a type struct.
i want to store some values in a type struct in the activex control.
the values must be known and changeable in the property form and
from external. i´ve tried it with class and module. internal with friend, external with public functions or properties.
no success.
how can i do this.

here is a graphic.

                 |-----------|
                 | Property  |
                 |   Form      |
                 |              |
                 |           |
                 |-----------|
                     /\
                     ||
                     ||
                     ||--->< values in type-end type struct
                     ||
                     ||
                     \/
                 |-----------|
                 |  ActiveX  |
 Public     |  Control    |
 values><|             |
                 |           |
                 |-----------|

thank you !
0
Comment
Question by:msvb2000
5 Comments
 
LVL 1

Expert Comment

by:justinhemphill
ID: 6937481
Split the struct into its various fields for the purposes of sending the data back and forward from the control.  Then reconstruct the struct inside the control once it has received all of its property values.
0
 
LVL 1

Expert Comment

by:justinhemphill
ID: 6937485
Split the struct into its various fields for the purposes of sending the data back and forward from the control.  Then reconstruct the struct inside the control once it has received all of its property values.
0
 
LVL 1

Expert Comment

by:soferstam
ID: 6937486
Do you mean this:
Public Type str
a As String
b As String
End Type
Dim o As str

Public Function test() As str
o.a = "abc"
test = o
End Function

Private Sub UserControl_Initialize()

End Sub

This should work.
Be carefull,there is a bug fixed with SP3: http://support.microsoft.com/default.aspx?scid=kb;EN-US;q223116
0
 
LVL 1

Accepted Solution

by:
ProgramIT earned 300 total points
ID: 6938473
Link Public Variable through the Property Get, Set and Let.
EG:
In Module declaration:
Private Type MyDataType
  MyString as string
  ANumber as long
  MoreData as String
End Type

Public MyData as MyDataType

In the class section use:
Public Property Get MyString() As String
    MyString = MyData.MyString
End Property

Public Property Let MyString(byval vData as string)
    MyData.MyString = vdata
End Property

etc.


0
 

Author Comment

by:msvb2000
ID: 6938498
Thanks ProgramIT, that´s it.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

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…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…

705 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

20 Experts available now in Live!

Get 1:1 Help Now