Michael Chai

I am SErVice-oRienTed !

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::
标题中的这个常量申明,不是会VB的人可能会不知道,比如--我。
查了半天搞明白啦,原来是强制转换为double啊~~

Msdn上查到的,还是贴出来,省得ms变地址得时候找不到。

The following example demonstrates correct usage of type characters and enclosing characters:

Option Strict Off
Public Const DefaultInteger = 100   ' Default is Integer.
Public Const DefaultDouble = 54.3345612   ' Default is Double.
Public Const MyCharacter = "a"C   ' Forces constant to be a Char type.
Public Const MyDate = #01/15/01#   ' Demonstrates DateTime constants.
Public Const MyTime = #1:15:59 AM#
Public Const MyLong = 45L   ' Forces data type to be a Long.
Public Const MySingle = 45.55!   ' Forces data type to be a Single.

The following table shows the enclosing characters and type characters available in Visual Basic.

Data type Enclosing character Appended type character
Boolean (none) (none)
Byte (none) (none)
Char " C
Date # (none)
Decimal (none) D or @
Double (none) R or #
Integer (none) I or %
Long (none) L or &
Short (none) S
Single (none) F or !
String " (none)
posted on 2006-02-01 06:34  cp  阅读(214)  评论(0)    收藏  举报