C# showDialog()显示结果而不调用
我有以下代码行来显示MessageBox中的窗口:C# showDialog()显示结果而不调用,c#,.net,wpf,messagebox,showdialog,C#,.net,Wpf,Messagebox,Showdialog,我有以下代码行来显示MessageBox中的窗口: MessageBox.Show(new ElbaKostenstellen(titel, loginid).ShowDialog().ToString()); 问题是,当我关闭它时,另一个MessageBox以true或false开头,但我从未告诉它这样做。 我怎样才能解决这个问题 这里有更相关的代码: string ganzes = sr.ReadToEnd();
MessageBox.Show(new ElbaKostenstellen(titel, loginid).ShowDialog().ToString());
问题是,当我关闭它时,另一个MessageBox以true
或false
开头,但我从未告诉它这样做。
我怎样才能解决这个问题
这里有更相关的代码:
string ganzes = sr.ReadToEnd();
string[] allezeilen = ganzes.Split('\n');
for (int i = 0; i < allezeilen.Length - 1; i++)
{
string[] separated = allezeilen[i].Split(';');
String datum = separated[0];
String titel = separated[1];
if (titel.Contains('"'))
{
titel = titel.Replace('"', ' ');
}
String betrag = separated[3];
buchrep.bookFromElbaCSV(datum, titel, betrag, loginid);
//ElbaKostenstellen ek = new ElbaKostenstellen(titel, loginid);
//ek.Show();
MessageBox.Show(new ElbaKostenstellen(titel, loginid).ShowDialog().ToString());
}
string ganzes=sr.ReadToEnd();
字符串[]allezeilen=ganzes.Split('\n');
for(int i=0;i
为了在表单上显示调用ShowDialog
的表单,不需要调用MessageBox.show
。尝试
new ElbaKostenstellen(titel, loginid).ShowDialog();
而不是
MessageBox.Show(new ElbaKostenstellen(titel, loginid).ShowDialog().ToString());
为了在表单上显示调用
ShowDialog
的表单就足够了,不需要调用MessageBox.show
。尝试
new ElbaKostenstellen(titel, loginid).ShowDialog();
而不是
MessageBox.Show(new ElbaKostenstellen(titel, loginid).ShowDialog().ToString());
这是因为ShowDialog的返回值为true或false 如文所述— 返回值 类型:System.Nullable布尔类型的可空值 指定活动是已接受(true)还是已取消 (错)。返回值是DialogResult属性的值 在窗户关上之前
这是因为ShowDialog的返回值为true或false 如文所述— 返回值 类型:System.Nullable布尔类型的可空值 指定活动是已接受(true)还是已取消 (错)。返回值是DialogResult属性的值 在窗户关上之前
你写这个字符串的时候告诉它的
MessageBox.Show(new ElbaKostenstellen(titel, loginid).ShowDialog().ToString());
因此,您需要从Elbakostellen处获取消息,而无需调用ShowDialog()您在编写此字符串时告诉它的
MessageBox.Show(new ElbaKostenstellen(titel, loginid).ShowDialog().ToString());
因此,您需要在不调用ShowDialog()的情况下从Elbakostellen获取消息
MessageBox.Show(new ElbaKostenstellen(titel, loginid).ShowDialog().ToString());
计算的第一位是
new ElbaKostenstellen(titel, loginid).ShowDialog()
这将显示对话框,并阻止代码的执行,直到对话框关闭
然后
MessageBox.Show(...)
执行并显示上一个对话框结果的字符串表示形式
我怀疑您不需要消息框.Show(..)
,只需要新的Elbakostellen(titel,loginid).ShowDialog()
让我们看看
MessageBox.Show(new ElbaKostenstellen(titel, loginid).ShowDialog().ToString());
计算的第一位是
new ElbaKostenstellen(titel, loginid).ShowDialog()
这将显示对话框,并阻止代码的执行,直到对话框关闭
然后
MessageBox.Show(...)
执行并显示上一个对话框结果的字符串表示形式
我怀疑您不需要MessageBox.Show(..)
,只需要新的ElbaKostenstellen(titel,loginid).ShowDialog()