What is a good way to code a messagebox in C#, like the AfxMessageBox in used in Visal C++?
For code like the following, there must be a "using..."
declaration missing because I got this error:
error CS0246: The type or namespace name 'MessageBoxButtons' could not be found (are you missing a using directive or an assembly reference?)
result = MessageBox.Show(message, caption, buttons, icon);
Also, is there a good way to write information out to a log file?
January 24th, 2008, 11:21 PM
Try "using System.Windows.Forms"
January 25th, 2008, 12:27 AM
If you're using Visual Studio classes/structures that have the correct namespace imported show up as light blue whereas ones that don't show up as normal text. An easy way to add the correct using statement (assuming the assembly containing the class is references - which System.Windows.Forms will be normally) you can put the cursor at the far right side of the name and a small red rectangle will show up. Put your mouse over this rectangle and a box will appear. Click the box and a menu shows up asking if you want to add the using statement.