Question : Visual Studio 2010: C#; Newbie Question

Hi,
I'm New to C# and .net so please forgive any offenses.

I'm working on project that is a C# Windows Class Library.   I'm trying to add a method to a class that uses a messagebox.   I'm showing an entry in the error list notifying me that the namespace 'Forms' does not exist in the namespace 'System.Windows'.   Here is the line of code:

global::System.Windows.Forms.MessageBox.Show("You have been changed!");

I am guessing that because this project type is a class library and not a windows project, that the System.Windows.Forms namespace is invalid.

Can anyone tell me if I can use the MessageBox command in this project and if so, what type of references need to be in the namespace section?

Thanks in advance,

KF

Answer : Visual Studio 2010: C#; Newbie Question

You understood wrongly, you need to 'add a reference'

In your solution explorer, right-click your project and select 'add reference'.

Then you can select the System.Windows.Forms-library from the list and add it to your project.

After that, it will show up when you try to use it in your code.

Random Solutions  
 
programming4us programming4us