I have created a .dll that I am using in my .exe project however I would like to display information in the .dll in a messagebox from the dll. I did the [DllImport("user 32.dll")] and it still will not show the messagebox. Basically I need this for debugging the dll file to see what information it is getting/sending. Is it possible for .dll's to show messagebox's? Any ideas?
C# Dll Messagebox
Collapse
X
-
Actually, you very much can.
See, there are certain references automatically added to certain project types. Forms apps get System, System.Data, System.Deployme nt, System.Drawing, System.Windows. Forms, and System.Xml automatically. So you can put using System.Windows. Forms at the top and not have to type it out all the time.
But just putting the using statement isn't the same as adding a reference. If you right-click the references folder, and click Add Reference, it will pop up a dialog where you can scroll down and select System.Windows. Forms. Then you can use all the objects in that namespace, including a messagebox.
I have tested this with a class library (dll) referenced in a console app, and I did get a messagebox popup.Comment
-
Originally posted by insertAliasActually, you very much can.
See, there are certain references automatically added to certain project types. Forms apps get System, System.Data, System.Deployme nt, System.Drawing, System.Windows. Forms, and System.Xml automatically. So you can put using System.Windows. Forms at the top and not have to type it out all the time.
But just putting the using statement isn't the same as adding a reference. If you right-click the references folder, and click Add Reference, it will pop up a dialog where you can scroll down and select System.Windows. Forms. Then you can use all the objects in that namespace, including a messagebox.
I have tested this with a class library (dll) referenced in a console app, and I did get a messagebox popup.
AHHH I was not adding it as a reference. That did the trick! Thanks a bunch!!Comment
-
hey, dont worry, haha, we've all been there once, haha take a look at this link just to look on how to add and remove and as insertalias said, references are automatically added to certain types of projects...
Adding-Removing References
joedeeneComment
Comment