-2

我在使用 messagebox.show 时遇到问题。我想要答案和这条线“你想尝试另一个临时转换吗?” 出现在带有 yesno 按钮的消息框上。

Public Class Form1
    Dim intFah As Windows.Forms.DialogResult

    Private Sub BtnFah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnFah.Click
        Try
            Dim intFah As Integer

            intFah = CInt(TxtBoxTemp.Text)
            intFah = (intFah * 9) / 5 - 32
            MessageBox.Show(intFah.ToString & ControlChars.CrLf & "Would you like to start another temp conversion?", MessageBoxButtons.YesNo)
        Catch
            MessageBox.Show("Would you like to start another temp conversion?", "System Error", MessageBoxButtons.YesNo)

        End Try
    End Sub
End Class
4

1 回答 1

1

您的代码不是为我构建的 - 这可能是因为在您的 MessageBox.Show 中:

MessageBox.Show(intFah.ToString & ControlChars.CrLf & "Would you like to start another temp conversion?", MessageBoxButtons.YesNo)

您没有传递正确数量的参数。根据链接,它需要文本、标题(标题),然后是按钮选项

如果我将其更改为:

MessageBox.Show(intFah.ToString & ControlChars.CrLf & "Would you like to start another temp conversion?", "A Caption", MessageBoxButtons.YesNo)

然后它会构建,当我运行该应用程序时,我可以根据您要查找的内容,将答案显示在一行中,并将文本显示在第二行中。

于 2013-03-20T02:35:56.570 回答