Steve Rudd

Steve Rudd

  • NA
  • 3
  • 0

New to C# - MeassageBoxIcon

Oct 29 2009 5:14 AM

Hi All,
Im new to C# and having an issue with MessageBoxIcon.
I am trying to use the same piece of code to show a message box which will need to display the appropriate icon ie error or exclamation etc.
In the example below, you can see that the icon name is hard coded as "Exclamation". What I would like to do is use the variable "str3" to tell the MessageBox which icon to display. Is this possible?
 
using
System;
using
System.Text;
using
System.Windows.Forms;
using
Autodesk.AutoCAD.Runtime;
using
Autodesk.AutoCAD.ApplicationServices;
using
Autodesk.AutoCAD.EditorInput;
using
Autodesk.AutoCAD.DatabaseServices;
[
assembly: CommandClass(typeof(Autodesk.AutoCAD.MsgBox.STDLMessageBox))]
namespace
Autodesk.AutoCAD.MsgBox
{
public class STDLMessageBox
{
[
LispFunction("ConcatStrings")]
static public string ConcatStrings(ResultBuffer args)
{
Array ArgsArray = args.AsArray();
string str1 = Convert.ToString(((TypedValue)(ArgsArray.GetValue(0))).Value);
string str2 = Convert.ToString(((TypedValue)(ArgsArray.GetValue(1))).Value);
string str3 = Convert.ToString(((TypedValue)(ArgsArray.GetValue(2))).Value);
MessageBox.Show(str1, str2, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return null;
}
}
}

Answers (5)