RSS Forums RSS

C# DLL

Please support our C# advertiser: DiscountASP.NET – 3 Months Free on C# Web Hosting
Reply
Posts: 104
Reputation: complete is an unknown quantity at this point 
Solved Threads: 0
complete's Avatar
complete complete is offline Offline
Junior Poster

C# DLL

  #1  
Nov 30th, 2008
After someone creates a DLL in C# using the Microsoft Visual development environment, how would another programmer take that code, make a new project that includes the DLL's source and make a GUI that uses the DLL'S API?
AddThis Social Bookmark Button
Reply With Quote  
Posts: 1,157
Reputation: dickersonka will become famous soon enough dickersonka will become famous soon enough 
Solved Threads: 133
dickersonka dickersonka is offline Offline
Veteran Poster

Re: C# DLL

  #2  
Nov 30th, 2008
you would just need to add it as a reference in the project

what specific piece are you having trouble with?
Custom Application & Software Development
www.houseshark.net
Reply With Quote  
Posts: 2,368
Reputation: alc6379 has a spectacular aura about alc6379 has a spectacular aura about alc6379 has a spectacular aura about 
Solved Threads: 112
Colleague
alc6379's Avatar
alc6379 alc6379 is offline Offline
Cookie... That's it

Re: C# DLL

  #3  
Dec 1st, 2008
Another thing to do, after you've made a reference to the DLL or project, is to use the using statement to include the namespace included in that DLL file. It's not absolutely required, but it does simplify using methods and classes from the DLL, rather than having to type out the fully qualified name of the method/class.

As a handy tip, you can use object explorer to look through a DLL's functions to determine what you're wanting to use.
Alex Cavnar, aka alc6379
Reply With Quote  
Posts: 104
Reputation: complete is an unknown quantity at this point 
Solved Threads: 0
complete's Avatar
complete complete is offline Offline
Junior Poster

Re: C# DLL

  #4  
Dec 1st, 2008
I have done a few things. I have created a console app to use as the front-end to the project. Then I have added the DLL as a reference like this:

1) In the Solution Explorer right-click "References" and select "Add Reference ...".

2) Select the "Browse" tab.

3) Navigate to the DLL and select it.

4) Add the appropriate using directive to the code file(s) where you want to use the DLL.


I have also found that I can add the Project that the DLL was made in into my new Solution file.

I have included the namespace of the DLL in the "using" section of my code.

And the intelligent type I am using recognizes this class when I declare it in my code.

But it does not seem to recognize all the methods (api's) of the class.

What am I doing wrong?

[img]http://i67.photobucket.com/albums/h292/Athono/first_problem.jpg[/img]

Strangely, "Equals", "GetHashCode", "GetType" and "ToString" are not seen in the DLL's source code for available methods for this class.

Also, I know that if you double click on the added reference, an Object Explorer should come up showing the available methods. This is not what happens:

[IMG]http://i67.photobucket.com/albums/h292/Athono/objects.jpg[/IMG]

So now to look closer at the DLL source code.Could there be a problem in the fact that the constructor ( private NookieBookieDoopieDoo() ) is
defined as a privvate? Could there be a problem that the methods are static?

It looks something like this:

namespace BladaFlabaDab
{

    public class NookieBookieDoopieDoo
    {

        private static readonly string SomethingYouDoNotNeedToKnow = @"SLAMADAMNADDORK";

        private NookieBookieDoopieDoo()
        {
        }



        public static void Send(string to, string subject, string body)
        {
            .
            .
            .
        }

        public static void Send(string to, string replyTo, string subject, string body)
        {
            .
            .
            .
        }

        private static void InitializeClient()
        {
            .
            .
            .
        }
    }
}
Could there be a problem in the fact that the constructor ( private NookieBookieDoopieDoo() ) is
defined as a privvate? Could there be a problem that the methods are static?
Reply With Quote  
Posts: 1,157
Reputation: dickersonka will become famous soon enough dickersonka will become famous soon enough 
Solved Threads: 133
dickersonka dickersonka is offline Offline
Veteran Poster

Re: C# DLL

  #5  
Dec 1st, 2008
you need to call it like this since it is static

  1. ClassName.MethodName();
  2.  
  3. NookieBookieDoopieDoo.InitializeClient();
  4. NookieBookieDoopieDoo.Send("to", "replyTo", "subject", "body");
Custom Application & Software Development
www.houseshark.net
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Similar Threads
Other Threads in the C# Forum
Views: 563 | Replies: 4 | Currently Viewing: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 3:29 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC