Im just trying to create a DLL file that contains license info for my program.
Basically, i just want to be able to reference text strings that i store in the DLL file.
I don't know how to store them, and how to access them, as i have never worked with DLL's before (at least not ones i have created)
I want to have about 5-7 text strings (company name, address details, serial number etc) that i can display on a form in my main app (assuming the dll file exists)
Checking for the file is no worrioes, just not sure about how i would store the info in a dll so i can retrieve it.
Can anyone please give me some suggestions
Cheers
Mc

Simple License Details Dll
ssuluh
You can create a resource dll, or just a dll that has methods to return the strings and so on that you need. A dll is just a bunch of code without an entry point, so it can't start itself.
Jason Prell
Yes, for the purposes of this project, the simple strings are fine. I imagine that as the projects continue and increase in complexity, i'll have to have a proper look at the resource settings and its application.
Thanks again spotty :)
Geoff Upham
Yes, that is what i want to do. (A DLL with methods to return values stored in the Dll)
I just don't understand how i should store the methods i want to reference in the Dll, having never looked at anything like this before, i don't know where to start.
Could you possibly give me some basic sample code for a method in the DLL and vb code to access it Or if not, just a suggestion as to what im looking for so i can work it out for myself :)
alll
Create a class library project
Public Class License
Private Shared strLicenseDetails As String = "Test field In License"
Private Shared DteProduct As Date = "#01/01/2001#"
Public Shared ReadOnly Property LicenseDetail() As String
Get
Return strLicenseDetails
End Get
End Property
Public Shared ReadOnly Property ProductDate() As Date
Get
Return DteProduct
End Get
End Property
''' <summary>
''' Use a resource string defined in the Project - > Resources (called TestResourceString of string type
''' </summary>
''' <value></value>
''' <remarks></remarks>
Public Shared ReadOnly Property StoredResource() As String
Get
Return My.Resources.TestResourceString
End Get
End Property
End Class
Something like this create a class with shared readonly methods that will return values and a one which will return a resource for this project as well. (Resource can be of different types)
Compile using Build or Rebuild
Then create your real project - in this case I create a console application
Module Module1
Sub main()
Dim x As String
x = License.LicenseDetail
x = License.StoredResource
Dim y As Date
y = License.ProductDate
End Sub
End Module
I add a reference to the Original Class Library Dll that I created - you need to look for the dll in the project folder \ Bin \ Debug or Release folder.
What this does is attaches the two together so you main project can see the class library in the dll.
At which point I can use the functionality in the Class License just as I would if it were in the main project.
I defined the properties as shared readonly as I dont want to have to create an instance of the class to use it and I only want the user to be able to read the contents as I've embedded them into the DLL code itself.
So I can simply call the properties on the license class and get the strings / dates from these properties.
Tom Kelley
Arun79
Using Resources is good as they can be different data and dont have to be you normal data types.
You'll see that when you go to My Project -> Resources
The Add Resource Button is actual a drop down and can add String, Image, Icon, text File or an existing file.
Allowing you to add more than just simple string like I showed but accessing the resources is almost identical to the string - but you just have to make sure that the data types match.
Perhaps that might be a little complex initially but once you do what you want - play around with it a little bit.
James 1
in the class project, you define a Public function that return the string and declare the properties.
On your another project, you create an instance to this class to return the values