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!

creating a dll using Visual Basic 6

Status
Not open for further replies.

gerrythistle

Technical User
Dec 2, 2002
8
CA
would like the ability to share information between 2 VB6 applications through a dll. The problem is that the 2nd app never gets the data supplied by the first.

Any ideas or direction?

Created and compiled the dll
added the reference in each application
declared as follows in APP#1
option Explicit
public x as CAnimal ' see class code below
Private Sub MDIForm_Load()
set x = new CAnimal
x.Animal = "Animal Name"
end sub

declared as follows in APP#2
option Explicit
public x as CAnimal
Private Sub MDIForm_Load()
set x = new CAnimal
msgbox x.Animal
end sub

Dll visual Basic Code
Option Explicit
Private mvarAnimal As String 'local copy

Public Property Let Animal(ByVal vData As String)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.Animal = 5
mvarAnimal = vData
End Property

Public Property Get Animal() As String
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.Animal
Animal = mvarAnimal
End Property

Thanks for any help
 
You can't. Each app creates a new and separate instance of the Animal object.

One way to share data between applications is via the file system (registry, ini file, text file, database etc)

Paul Bent
Northwind IT Systems
 
Can't you declare an ActiveX EXE's Instancing property to MultiUse, causing only one copy to load even though run many times?

Can you make this work the same for DLLs?

Someone with more knowledge has to take it from here.
 
I've given example code of exactly how to do this in this forum in the past. A keyword search should find it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top