Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Initializing DLL Classes

Status
Not open for further replies.

ndalli

Programmer
Nov 6, 1999
76
MT
Hi,

I am creating a DLL containing a number of LET/GET public properties in a class module. Depending on the input a screen(form) will be showed. One of these properties is for example ShowUserRoles.

=====
Public Property Let ShowUserRoles(ByVal vData As Boolean)
mvarShowUserRoles = vData
End Property
Public Property Get ShowUserRoles() As Boolean
ShowUserRoles = mvarShowUserRoles
End Property
====

At what stage does the DLL goes through all the classes to check how the properties are set, because the value of mvarShowUserRoles (for example) is always set to false?

Many thanks in advance

 
Is this what you are looking for?

project references dll

in Form xyz

private sub form_load
dim x as clsModule

set x as new clsModule

x.showuserroles = true
x.Method

end sub

In class Module:
Public sub/function Method

if mvarShowUserRoles then
'code to execute
end if

end sub/function

Or am I missing something in your question?
[lol]

The pen is mightier than the sword - and quite frankly . . easier to write with
 
Sorry I think I was not clear.

Basically the structure of my DLL project is:

- Class Module - Holding all the properties for this DLL
- Module - Containing all the global variables
- 3 Forms - These will be displayed depending on properties' values

When I call the DLL from the main exe project, I need to know which properties are set to true so that I will be able to call the right Form.

The problem is that I am not sure from where the DLL starts executing when it is called. The reason being that all the properties will be initially set to false.
 
Class modules include an Initalize event. I general practice, this is used to set up what-ever you need in the
load / initalize process, including setting the private (variable) members to desired values.




MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
The following is the code I am using:

Option Explicit
Private mvarShowUserRoles As Boolean


Private Sub Class_Initialize()
'**** AT THIS POINT THE VARIABLE mvarShowUserRoles IS STILL
'**** FALSE WHEN THE CALLING PROGRAM SET IT TO TRUE
If mvarShowUserRoles = True Then
frmRoles.Show vbModal
End If
End Sub
Public Property Let ShowUserRoles(ByVal vData As Boolean)
mvarShowUserRoles = vData
End Property
Public Property Get ShowUserRoles() As Boolean
ShowUserRoles = mvarShowUserRoles
End Property

Many thanks
 
Private Sub Class_Initialize()
'**** AT THIS POINT THE VARIABLE mvarShowUserRoles IS STILL
'**** FALSE WHEN THE CALLING PROGRAM SET IT TO TRUE
If mvarShowUserRoles = True Then
frmRoles.Show vbModal
End If
End Sub


I believe frmRoles will never show until you set Property ShowUserRoles anywhere in your application but only AFTER creating a new instance of your class.

However, if mvarShowUserRoles is public, and another class module will set the variable, the above code may work when you create an instance of the above class.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top