I have never used my own dlls putting classes into DLLs and using them and I have decided to do it with this program as it is such a big program.
I have designed my class as it was with the program declaring some varibles as Public and the a Public Sub and I want my program to be able to fill the varibles with something then run the Public sub which will do all its work then fill another couple of varibles itself then when finished my program needs to read those varibles that the DLL filled out itself.
As I have done this before I wasn't sure how to do it so did it like normal I created the DLL then put a Reference into my program to use it but then of course I can't see the varibles I have declared it just cant use the DLL. When speaking to my mate he said I need to put something special in the top of the DLL in order to use it and told me to look online and find an example one.
I was wondering if anyone here could help me. What do I need to put in the DLL to use it in my program and is there anything that I need to put in the top of my form or anything??
Your post is a little confusing but it sounds like you are just putting variables in a dll project?
when you make dlls you put classes in them, which you instantiate like normal, or give them 'public shared' functions etc for use without an instance.
Basically, a dll project is essentially no different from just having class files in your project, except that they are kept in different namespaces (can have diff references etc) but you go about using them the same way.
AntRush - Real-Time Strategy game, based around ants!
You shouldnt be trying to fill these "public variables" from your program. Create some Public Properties or Functions/Methods and fill / access them from there.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Ok Well it doesn't seem to work Here is whats in my DLL:
Authentication.Class
Code:
Public Class Authentication
Public AuthenticationType As Integer
Public Username As String
Public Password As String
Public Level As String
Public DatabasePath As String
Public Authenticated As Boolean
Public Sub Authenticate()
' MY WORKING CODE GOES HERE
End Sub
End Class
Then I simply open my main project Add Reference to it then open my form and try to use the DLL. It sees the DLL but I am not sure how to use it. I have attached a screenshot to show you what my form does when I try to use it. Its prob just me being stupid. If I used it like I normally do:
Code:
MyVarible = ThisValue
And I would normally just put that in the form where the varible is in a Module
when I do that here it just says its not declared.
My mate is a profressional programmer and he said there was a little bit of code that needs to go at the top of the dll in order for vb.net to be able to use varibles in it.
Don't Worry I have managed to do it myself playing around with it. I have never really used classes or DLLs so playing around I managed to do it. For those of you in my situation which will prob be none I had to do this:
Inherits Global.DLL.CLASSNAME
So in my case it was:
Inherits Global.Authentication.Authentication
Because my DLL Project was called Authentication and My class in the DLL was called Authentication. :-)
Nope its messed it up. Iafter adding tht code my actual form as just gone. I only have the code to the form and i can't seem to get it back. I have just lost two whole forms. Anyway of getting it back?
What the hell have I done wrong?
RobDog888 Please could you give me examples of what you mean and how to do it as it doesn't make much sense to me. I am prob seeming really dumb right now but its something I need to get done.