I want to build one Class Function (dll) and put it in one spot on the server so that it can be called by multiple programs. I do not want to put a copy of the class in every single program folder.
That way, if I have to make a change to the class, I do not have to replace the dll in 50 different folders.
I currently import the dll into the references for each project I do and I call it like below:
Dim objConnectPropertiesType As New clsTesting.clsTesting
aRegionType = objConnectPropertiesType.GetRegion(aConnection)
Can anyone help?
Thanks
Here is an example of my class.
Public Class clsTesting
Public cStrJPMsg, cStrJPRegionType As String
Public cJPArray(3) As String
Public Function GetRegion(ByVal FileLoc As Array) As Array
Try
'I am reading a file and sending back
'information for a database connection
'based on what is in the file
'Data from file could be PROD, UAT or UT
cStrJPRegionType = "PROD" 'got it from file
If cStrJPRegionType = "PROD" Then
cJPArray(0) = "Database connection string for PROD Server"
cJPArray(1) = "UT Server"
ElseIf cStrJPRegionType = "UAT" Then
cJPArray(0) = "Database connection string for UAT Server"
cJPArray(1) = "UAT Server"
ElseIf cStrJPRegionType = "UT" Then
cJPArray(0) = "Database connection string for UT Server"
cJPArray(1) = "UT Server"
End If
GetRegion = cJPArray
Exit Function
Catch ex As Exception
cStrJPMsg = ex.Message
cJPArray(2) = cStrJPMsg
GetRegion = cJPArray
Exit Function
End Try
GetRegion = cJPArray
End Function
End Class
That way, if I have to make a change to the class, I do not have to replace the dll in 50 different folders.
I currently import the dll into the references for each project I do and I call it like below:
Dim objConnectPropertiesType As New clsTesting.clsTesting
aRegionType = objConnectPropertiesType.GetRegion(aConnection)
Can anyone help?
Thanks
Here is an example of my class.
Public Class clsTesting
Public cStrJPMsg, cStrJPRegionType As String
Public cJPArray(3) As String
Public Function GetRegion(ByVal FileLoc As Array) As Array
Try
'I am reading a file and sending back
'information for a database connection
'based on what is in the file
'Data from file could be PROD, UAT or UT
cStrJPRegionType = "PROD" 'got it from file
If cStrJPRegionType = "PROD" Then
cJPArray(0) = "Database connection string for PROD Server"
cJPArray(1) = "UT Server"
ElseIf cStrJPRegionType = "UAT" Then
cJPArray(0) = "Database connection string for UAT Server"
cJPArray(1) = "UAT Server"
ElseIf cStrJPRegionType = "UT" Then
cJPArray(0) = "Database connection string for UT Server"
cJPArray(1) = "UT Server"
End If
GetRegion = cJPArray
Exit Function
Catch ex As Exception
cStrJPMsg = ex.Message
cJPArray(2) = cStrJPMsg
GetRegion = cJPArray
Exit Function
End Try
GetRegion = cJPArray
End Function
End Class