After using a period of SQL2005, it is found that the Exception handling message box (Exceptionmessagebox) function is very good.
To copy to the Clipboard or to view detailed technical information with the appropriate help associated with it
analyzed the relevant files and found that this feature is included in the C:Program FilesMicrosoft SQL The Microsoft.NetEnterpriseServers.ExceptionMessageBox.dll in the server90shared directory can be referenced directly in the. NET project, as the following example is invoked:
Example 1
try
{
string[] aa = new string[1];
aa[1] = "数组越界哈";
}
catch (Exception ex)
{
ExceptionMessageBox box1 = new ExceptionMessageBox(ex);
box1.Show(this);
}
Example 2
ExceptionMessageBox box1 = new ExceptionMessageBox("一个简单的问题,你确认执行操作么?");
box1.Symbol = ExceptionMessageBoxSymbol.Question;
box1.Buttons = ExceptionMessageBoxButtons.YesNo;
box1.Caption = "问一下啊";
DialogResult dr = box1.Show(this);
string msg = string.Empty;
switch (dr)
{
case DialogResult.Yes:
msg = "你选择了【是】";
break;
case DialogResult.No:
msg = "你选择了【否】";
break;
}
MessageBox.Show(msg);
In addition, you should also put C:Program FilesMicrosoft SQL Server90sharedzh-chs under the Microsoft.NetEnterpriseServers.ExceptionMessageBox.resources.dll handcuffs out, this is the corresponding Simplified Chinese resources