1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

MessageBox references in a DLL project

Discussion in 'C#' started by ThermoSight, Jul 10, 2010.

  1. ThermoSight

    ThermoSight New Member

    Jul 10, 2010
    Likes Received:
    Trophy Points:

    Back again for still more help ....

    I am creating a nice li'l DLL project ... very simple, very concise. One source file with three small classes. So easy that even I oughtta be able to make it work, B U T I am thwarted yet again ....

    Before starting off on a long journey, I test the user's arguments and if there is a problem with the args, I WANTED TO call MessageBox and inform the user of the problem.

    I can do that just fine when the code is in an ordinary Windows project. But the IDENTICAL code (a cut-and-paste) dies when placed inside a DLL project.

    Specifically, it fails to compile, informing me that System has no Windows component (in the statement "Using System.Windows.Form"). Then, because that statement failed, the call to MessageBox fails.

    So, am I doing something wrong coding-wise, or is it the case that one cannot make calls to forms (or at least MessageBox) from a DLL ?

    (Incidentally, Intellisense seems to agree that System does not contain a 'Windows' ... it ain't listed in the intellisense list box).

    thanks for any light you can shed on this very vexing problem.

    OOOPS ... forgot to mention ... using VS2008 and .NET 3.5 on an XP machine.


Share This Page