消息BOX未显示在InfoPath表单

时间:2016-01-07 17:46:15

标签: c# messagebox infopath

在窗体上打开视图但屏幕显示为空白时,应显示消息框?我不知道为什么。我尝试添加对Windows.Forms的引用以及

 using Microsoft.Office.InfoPath;
 using System;
 using System.Xml;
 using System.Windows.Forms;
 using System.Xml.XPath;

namespace Form1
{
    public partial class FormCode
    {
      public void InternalStartup()
      {
      }

      public static DialogResult FormEvents_ViewSwitched(object sender, ViewSwitchedEventArgs e)
      {
        string string1 = "Error";
        string string2 = "Empty field found on form";
        // Set button of type "MessageBoxButton" 
        MessageBoxButtons button = MessageBoxButtons.YesNo;
        // Static method, referenced without an object but just using the class 
        return (MessageBox.Show(string1, string2, button));
      }
    }
}

1 个答案:

答案 0 :(得分:0)

你应该使用以下

MessageBox.Show("Display Error Message Text Here", "Title that appears on MessageBox here", MessageBoxButtons.YesNo);

还谷歌如何使用string.Format或string.Join或string.Concat为您的消息