是什么在VB 6命令$和命令之间的区别? [英] What is difference between Command$ and Command in VB 6?

查看:123
本文介绍了是什么在VB 6命令$和命令之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是命令$和命令的区别在VB 6?

  MSGBOX命令$
MSGBOX命令


解决方案

你看到的任何时间 $ 在VB 6功能后,则意味着函数是一个字符串版本,这意味着它返回一个类型的值字符串。没有美元符号的版本是功能,当然这意味着它返回一个类型的值

在一般情况下,你应该的总是的preFER的字符串版本在版本。

结果
美元符号也意味着同样的事情,如果它出现在代替指定类型的变量名后。在这里,这是一个更大的家族了早期版本的BASIC必要的,而是由时间甚至VB 6赶到现场,坚决过时的速记类型声明字符的一部分。例如:

 暗淡名$

表示名为名称 A变量的类型为字符串。另一种方法(和preferred!)表示法是:

 昏暗的名字作为字符串

如果你要处理的遗留code其中这些看起来,这里的完整性整个列表:

 &安培;长
整数%
#双
!单
@十进制
$字符串

What is difference between Command$ and Command in VB 6?

MsgBox Command$
MsgBox Command

解决方案

Any time you see a $ after a function in VB 6, it means that the function is a String version, meaning it returns a value of type String. The version without the dollar sign is a Variant function, which of course means it returns a value of type Variant.

In general, you should always prefer the String versions over the Variant versions.


The dollar sign also means the same thing if it appears after a variable name in lieu of a specified type. Here, it's part of a larger family of shorthand "type declaration characters" that were necessary in earlier versions of BASIC, but firmly antiquated by the time even VB 6 arrived on the scene. For example:

Dim name$

indicates a variable named name that is of type String. The alternative (and preferred!) notation is:

Dim name As String

In case you're dealing with legacy code where these appear, here's the entire list for completeness:

&   Long
%   Integer
#   Double
!   Single
@   Decimal
$   String

这篇关于是什么在VB 6命令$和命令之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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