|
-
Mar 11th, 2003, 09:24 AM
#1
Thread Starter
New Member
-
Mar 11th, 2003, 09:33 AM
#2
VB Code:
' Module:
Public g_strYourVariable As String
' User control:
Public Property Get YourVariable() As String
YourVariable = g_strYourVariable
End Property
Public Property Let YourVariable(ByVal strVar As String)
g_strYourVariable = strVar
End Property
-
Mar 16th, 2003, 10:11 AM
#3
Thread Starter
New Member
axion_sa did not understood the problem
Go through the posted message thoroughly, it seems you did not understand what's the requirement.
Explanation of the above problem with an example .....
Everybody must have used vbCrLf to introduce a line feed in the string to be displayed.
Where does this vbCrLf come from, obviously from one of the 3 VB standard library. I don't remember at present but it is defined in VBA. Where ever it may it is easy to find through the object browser. Find it and you will notice that it comming from a Standard Module and not from a Class.
What axion_sa has mentioned is a Public String Property that is available only through the object of that particular class. He is correct if the requirement is that you want a public string property for an object.
But here what I want is that the string should not be part of any object (i.e., class) but should be avialable Globally like vbCrLf is avialable globally.
For this one needs a Standard module to be exposed from the ActiveX project. But the Standard module is public only within the ActiveX project and not out side. So how could one expose Standard modules from an ActiveX project. If one could do that he/she can expose a public string constant from the ActiveX project to other client app.
-
Mar 16th, 2003, 01:16 PM
#4
The correct way to do this would be to declare the constant in a Public Module,
however VB doesn't allow you to create such an animal, leaving you only with the option of creating a Global MultiUse Class Module and use Read-Only properties.
(as you've already discovered.
This is simply a limitation of VB, if you really need to create these constants in the correct way,
use Visual C to create the DLL instead.
Personally, I think using a Global MultiUse class module is a sufficient work-around as it gives you the functionality you require.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|