Rob Maron Rob Maron - 1 year ago 115
C# Question

MessageBox.Show not working

This is my code: (It's a dynamic link library)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Forms;

namespace DLL
public class Main

However, Visual Studio gives me the following error:

"The name MessageBox.Show does not exist in the current context."
Does anybody see a problem with my code? I've added references to System.Windows.Forms. Thanks!

Answer Source

No you can't, if you are in a console application you could use Console.WriteLine(). Otherwise, if you are in a dll, you could just add something in the EventLog.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download