消息框标题未设置 [英] Title of Message box not setting up

查看:94
本文介绍了消息框标题未设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Visual Basic 6中编写一些代码.它也使用Msgbox功能.现在,我对此进行了搜索,我知道,如果要设置消息"框的标题,则语法如下:

I am writing some code in Visual Basic 6. It also uses the Msgbox funtion. Now I searched this and I got to know that if you want to set the title of the Message box then this is the syntax:

Msgbox(<Prompt>,<Title>)

例如,我这样写:

MsgBox ("Incorrect Answer!","QM")

它说:

编译错误 预期:=

有人可以告诉我这是什么问题吗?

Can someone tell me what is the problem?

推荐答案

使用VB6,您可以请求响应,并根据答案执行某些操作,也可以只显示一条消息.

With VB6, you can either request a response, and do something based on the answer, or you can simply display a message.

如果您想知道单击了什么按钮,则需要使用函数格式-也就是说,必须使用方括号.

If you want to know what button was clicked, you need to use the function format - that is, you must use the brackets.

如果您只想显示一条消息,则不要使用方括号.

If you simply want to display a message, then you don't use the brackets.

因此,如果您只想显示消息,然后继续,请执行以下操作:

So if you want to just display the message, then continue, do this:

MsgBox "Incorrect Answer!", , "QM"

但是,如果您想知道用户单击了哪个按钮(例如,为他们提供再次尝试,请单击取消,则需要一个变量,然后使用方括号表示它是一个函数:

But if you want to know which button the user clicked (e.g. to offer them a try again, cancel, then you need a variable, and you use the brackets to signifify that it's a function:

Dim response = MsgBox("Try again?", MsgBoxStyle.YesNo, "QM")

然后您可以查看response变量以找出用户单击了哪个按钮.

You can then look at the response variable to find out which button the user clicked.

几页可供参考:

http://vb6reference.tomswebdesign.net/msgbox.html

https://msdn.microsoft.com/en-us/library/139z2azd(v=vs.90).aspx

这篇关于消息框标题未设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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