Creating a global instance of user defined Class

mpv55

New member
Joined
Jun 27, 2012
Messages
1
Reaction score
0
Points
0
I have created a control (class) in VB.NET which reads data from a data file. It works fine with VB.NET. I would like to program it in VBA for creating some functions. My problem is how to create a global instance of this class. So, I do not have to read each time the data from the file.

In the following code, SteamTablesGrid is a class which is created in VB.NET. I created a global instance of it as StmTblGrd. In function ReadGrid i read the data file. But the function LiqProp does not work.

Any help is appreciated.

Mahendra


Code:
Dim StmTblGrd As New SteamTablesGrid
Public Function ReadGrid(Fname As String) As Boolean
    StmTblGrd.OpenGrid (Fname)
    ReadGrid = True
End Function
Public Function LiqProp(Temp As Double, Press As Double, Nprop As Integer) As Double
StmTblGrd.SepBoundary = 0
StmTblGrd.Temperature = Temp
StmTblGrd.Pressure = Press
LiqProp = StmTblGrd.LiqProp(Nprop)
End Function
 
Back
Top