messagebox.show 有问题 [英] Having trouble with the messagebox.show

查看:32
本文介绍了messagebox.show 有问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 messagebox.show 时遇到问题.我想要答案和这一行您想尝试另一个临时转换吗?"出现在带有 yesno 按钮的消息框中.

I'm having trouble with the messagebox.show. I want the answer and this line "would you like to try another temp conversion?" to appear on a message box with yesno buttons.

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 中:

Your code didn't build for me - it's probably because in your MessageBox.Show:

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

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

You aren't passing the right number of parameters. As per the link, it needs the text, a caption (title) and then the button options

如果我把它改成:

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

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

Then it builds and when I run the app I can get the answer appearing in one line and the text on a second line as per what you're looking for.

这篇关于messagebox.show 有问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆