Solved

ActiveX Control Problem

Posted on 2002-04-12
5
152 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SLMGR Switches Are Not Working On KMS Host 3 113
Recommendation vb6 to vb.net or others 14 176
Automatic Email Reminder 4 58
backup program with robocopy 6 45
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
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…

829 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