无法转换为' CodingStandardsImprovement.MainProgram.MainConversion'到' System.Windows.Forms.IWin32Window'

时间:2017-07-19 20:15:58

标签: c#

在消息框中收到此消息,我正在使用MetroFramework尝试显示消息框但是我收到此错误(CS1503)。

            while (true)
            {

                try
                {
                    Var.borrowAmountNumber = int.Parse(borrowAmount);
                    Var.loanLengthNumber = int.Parse(loanLength);
                    Var.interestRateNumber = float.Parse(interestRate);
                    Var.i = true;
                    break;
                }
                catch (Exception)
                {
                    MetroMessageBox.Show(this, "Please enter a integer.","Error", MessageBoxButtons.OK, MessageBoxIcon.Warning,100);

                    break;
                }
            }

1 个答案:

答案 0 :(得分:0)

修正:

替换:  MetroMessageBox.Show(this, "Please enter a integer.","Error", MessageBoxButtons.OK, MessageBoxIcon.Warning,100);

使用: MetroMessageBox.Show(Form.ActiveForm, "Please enter a integer.","Error", MessageBoxButtons.OK, MessageBoxIcon.Warning,100);

这解决了这个问题。