Solved

A public variable Within Classes in DLL

Posted on 2002-07-17
6
154 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
6 Comments
 
LVL 14

Expert Comment

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

Expert Comment

by:gencross
Comment Utility
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 20 total points
Comment Utility
Put you valuable on module
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 26

Expert Comment

by:EDDYKT
Comment Utility
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
Comment Utility
This property will go in the class module.
0
 
LVL 2

Expert Comment

by:priya_pbk
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

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…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

743 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

16 Experts available now in Live!

Get 1:1 Help Now