Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

A public variable Within Classes in DLL

Posted on 2002-07-17
6
Medium Priority
?
161 Views
Last Modified: 2010-05-02
I want to use a public variable in my Activex project, I need that all my calsses will "see" the variable but he wont be visible outside to projects that using my DLL.

Something like "Public DLL" variable.

Can I do it ?

0
Comment
Question by:computech1
[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
6 Comments
 
LVL 14

Expert Comment

by:ajexpert
ID: 7159213
Hi,
   Well It would be nice to have a property instead of public variable.
0
 
LVL 4

Expert Comment

by:gencross
ID: 7159238
You will want to use a property and declare it as Friend.  This will give all classes access to the property, but no one outside the DLL.

Friend Property Get IntValue() As Variant

End Property

Friend Property Let IntValue(ByVal vNewValue As Variant)

End Property
0
 
LVL 26

Accepted Solution

by:
EDDYKT earned 80 total points
ID: 7159273
Put you valuable on module
0
Independent Software Vendors: 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!

 
LVL 26

Expert Comment

by:EDDYKT
ID: 7159276
Define your valuable in module.

I can't see my last comment even I reload the question. Strange?
0
 
LVL 4

Expert Comment

by:gencross
ID: 7159278
This property will go in the class module.
0
 
LVL 2

Expert Comment

by:priya_pbk
ID: 7159286
Add a General Module to your DLL project and declare a public variable in it. Like this:

'this goes in the general module of the DLL
Public xt As Integer

Sub Main()
xt = 5
End Sub

Therefore the startup form of your dll project will be Sub main

In the class module , you can access this value
Function mytest() As Integer
MsgBox xt
mytest = 1
'or you assign the value to mytest function
End Function

-------------------------

Therefore when you call this dll after you make an object,..

'In standard exe

Dim p As New pr.Class1
Private Sub Command1_Click()
p.mytest
End sub

Hope this helps!!

-priya

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…
Suggested Courses

664 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