Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/277.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# InfoPath表单上未显示消息框_C#_Messagebox_Infopath - Fatal编程技术网

C# InfoPath表单上未显示消息框

C# InfoPath表单上未显示消息框,c#,messagebox,infopath,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

在窗体上打开视图但屏幕显示为空白时,消息框应出现?我不知道为什么。我还尝试添加对
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));
      }
    }
}

您应该使用以下命令

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

另外,在谷歌上搜索如何使用string.Format或string.Join或string.Concat处理您的邮件

您应该使用以下命令

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

另外,用谷歌搜索如何在邮件中使用string.Format或string.Join或string.Concat

完全删除MesageBoxButtons并尝试以下
返回(MessageBox.Show(string1、string2、MessageBoxButtons.YesNo)时会发生什么
仍然没有发生任何事情。但是,视图切换,消息框现在确实出现。至少我修复了消息框未正确显示的第一个/初始问题。如果完全删除MesageBoxButtons并尝试以下
返回(MessageBox.Show(string1、string2、MessageBoxButtons.YesNo)会发生什么情况
仍然没有发生任何事情。视图切换,但是消息框现在确实出现了。至少我修复了消息框显示不正确的第一个/初始问题。