Results 1 to 6 of 6

Thread: How to get a message box in a dll?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Location
    I'm right here!
    Posts
    849

    Question How to get a message box in a dll?

    hello! how are you all??

    I built a dll in c#, and I want it to show a message box...
    I can't seem to do it...


    can anyone help?

    thanks!!

    Dekel C.

  2. #2
    Fanatic Member
    Join Date
    Mar 2005
    Posts
    537

    Re: How to get a message box in a dll?

    Did you import the namespace System.Windows.Forms?

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: How to get a message box in a dll?

    Did you add a reference to the System.Windows.Forms assembly, which needs to be done before you can import any namespace it contains. The Windows Control Library project type has the reference and import by default, just like the Windows Application project. If you've created a Class Library project then you'll have to add them manually. There's no reason to believe that a Class Library is going to be used by a Windows Application so there is no specific reason to reference that assembly by default. A Cclass Library may just as easily be used by a Web Application or a Console Application.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4
    Lively Member
    Join Date
    Jan 2006
    Posts
    121

    Re: How to get a message box in a dll?

    Wow thats great to know

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Location
    I'm right here!
    Posts
    849

    Re: How to get a message box in a dll?

    For some reason I am unable to add reference to System.Windows.Forms

    It is simply not recognised by C# express.

    Anyone knows why is that?

    thanks
    Dekel C.

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: How to get a message box in a dll?

    Right click your project in the Solution Explorer and select Add Reference. On the .NET tab scroll down to System.Windows.Forms and double-click it. Done. From there you would still have to fully qualify every type from System.Windows.Forms namespace unless you add a 'using' statement to each file:
    Code:
    using System.Windows.Forms;
    Attached Images Attached Images  
    Last edited by jmcilhinney; Apr 6th, 2006 at 04:51 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width