Rob Maron Rob Maron - 6 months ago 46
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!


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.