Vb.net messagebox.show出现问题

Vb.net messagebox.show出现问题,vb.net,winforms,Vb.net,Winforms,我在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 T

我在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

您的代码不是为我生成的-可能是因为在您的MessageBox中。显示:

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
MessageBox.Show(intFah.ToString & ControlChars.CrLf & "Would you like to start another temp conversion?", MessageBoxButtons.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
如果我将其更改为:

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
MessageBox.Show(intFah.ToString & ControlChars.CrLf & "Would you like to start another temp conversion?", "A Caption", MessageBoxButtons.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