I´ve got the following code-line to show a Window in a MessageBox:
MessageBox.Show(new ElbaKostenstellen(titel, loginid).ShowDialog().ToString());
The problem is, that when I close it, another MessageBox starts with true
or false
, but I never told it to do.
How can I fix that?
Here´s more relevant code:
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());
}
In order to show a form calling ShowDialog
on it is enough, a call to MessageBox.Show
is unnecessary. Try;
new ElbaKostenstellen(titel, loginid).ShowDialog();
instead of
MessageBox.Show(new ElbaKostenstellen(titel, loginid).ShowDialog().ToString());