JBTALKS.CC

标题: vb.net 什么是dim [打印本页]

作者: goodday    时间: 2008-7-19 06:42 PM
标题: vb.net 什么是dim
Data TypeSize in BytesDescriptionType
Byte18-bit unsigned integerSystem.Byte
Char216-bit Unicode charactersSystem.Char
Integer432-bit signed integerSystem.Int32
Double864-bit floating point variableSystem.Double
Long864-bit signed integerSystem.Int64
Short216-bit signed integerSystem.Int16
Single432-bit floating point variableSystem.Single
StringVariesNon-Numeric TypeSystem.String
Date8System.Date
Boolean2Non-Numeric TypeSystem.Boolean
Object4Non-Numeric TypeSystem.Object
Decimal16128-bit floating point variableSystem.Decimal


dim 是用来定义 一个 object 或类型
  1. Imports System.Console
  2. Module Module1Sub Main()
  3. Dim a,b,c as Integer
  4. 'declaring three variables of type integer
  5. a=10
  6. b=20
  7. c=a+b
  8. Write("Sum of a and b is" & c)
  9. End Sub

  10. End Module
复制代码

[ 本帖最后由 goodday 于 2008-7-19 06:46 PM 编辑 ]
作者: goodday    时间: 2008-7-19 06:50 PM
你要用电脑的资源麻
你要和电脑 申请咯

然后电脑会 发那个空间给你
但你要 讲好你要什么的 空间
如  string , integer , long

如果你要很大的 就申请大的

否则不够 装
作者: dious    时间: 2008-7-19 07:23 PM
請問long是什么呢
作者: goodday    时间: 2008-7-19 08:13 PM
Visual Basic typeCommon language runtime type structureNominal storage allocationValue range
Boolean
Boolean
Depends on implementing platform
True or False
Byte
Byte
1 byte
0 through 255 (unsigned)
Char (single character)
Char
2 bytes
0 through 65535 (unsigned)
Date
DateTime
8 bytes
0:00:00 (midnight) on January 1, 0001 through 11:59:59 PM on December 31, 9999
Decimal
Decimal
16 bytes
0 through +/-79,228,162,514,264,337,593,543,950,335 (+/-7.9...E+28) † with no decimal point; 0 through +/-7.9228162514264337593543950335 with 28 places to the right of the decimal;
smallest nonzero number is +/-0.0000000000000000000000000001 (+/-1E-28) †
Double (double-precision floating-point)
Double
8 bytes
-1.79769313486231570E+308 through -4.94065645841246544E-324 † for negative values;
4.94065645841246544E-324 through 1.79769313486231570E+308 † for positive values
Integer
Int32
4 bytes
-2,147,483,648 through 2,147,483,647 (signed)
Long (long integer)
Int64
8 bytes
-9,223,372,036,854,775,808 through 9,223,372,036,854,775,807 (9.2...E+18 †) (signed)
Object
Object (class)
4 bytes on 32-bit platform
8 bytes on 64-bit platform
Any type can be stored in a variable of type Object
SByte
SByte
1 byte
-128 through 127 (signed)
Short (short integer)
Int16
2 bytes
-32,768 through 32,767 (signed)
Single (single-precision floating-point)
Single
4 bytes
-3.4028235E+38 through -1.401298E-45 † for negative values;
1.401298E-45 through 3.4028235E+38 † for positive values
String (variable-length)
String (class)
Depends on implementing platform
0 to approximately 2 billion Unicode characters
UInteger
UInt32
4 bytes
0 through 4,294,967,295 (unsigned)
ULong
UInt64
8 bytes
0 through 18,446,744,073,709,551,615 (1.8...E+19 †) (unsigned)
User-Defined (structure)
(inherits from ValueType)
Depends on implementing platform
Each member of the structure has a range determined by its data type and independent of the ranges of the other members
UShort
UInt16
2 bytes
0 through 65,535 (unsigned)

msdn 的 目录
作者: goodday    时间: 2008-7-19 08:20 PM
当我要存

65535 + 1 = 65536 的糖果时

我和电脑 借了 char  的盒子
多了一个 糖果 怎么办??

会error 咯
那你就要 string 咯

如果你要哦 用

2,147,483,647  +  1000 = 2,147,484,647
integer 肯定  装不下的

那你要用 long  的 9,223,372,036,854,775,807

作者: dious    时间: 2008-7-19 08:33 PM
怎么數字變化那么多
運用hex來算嗎?
作者: goodhermit95    时间: 2008-7-19 08:41 PM
简单来说,数学的代数

1+x=2
Dim x as string

1+x=2
x=textbox1.text
=)
作者: dious    时间: 2008-7-19 08:48 PM
數目怎么可以用String呢
作者: goodday    时间: 2008-7-19 09:32 PM
可以 只是 是当文字来处理
不能 sort 的
作者: dious    时间: 2008-7-19 09:38 PM
不、一個數學運算不可以用stringDe
作者: goodday    时间: 2008-7-19 09:43 PM
原帖由 dious 于 2008-7-19 09:38 PM 发表
不、一個數學運算不可以用stringDe


dim a as integer = 10
dim b as string = 10

dim w as integer = 100

dim c as string = a+ b
result = 1010

dm  d as integer = a+b
result = error !!!

dim e as integer = a + w
result = 110
作者: dious    时间: 2008-7-19 09:47 PM
這樣就是說integer,不對馬?
作者: goodhermit95    时间: 2008-7-19 10:36 PM
我比较常用string
作者: dious    时间: 2008-7-19 10:40 PM
我不擅長programming
所以沒關系
作者: goodhermit95    时间: 2008-7-19 10:42 PM
标题: 回复 #14 dious 的帖子
那么你擅长……图片是吗,没记错
作者: dious    时间: 2008-7-19 10:44 PM
對啊              
design
作者: goodday    时间: 2008-7-20 01:41 PM
原帖由 goodhermit95 于 2008-7-19 10:36 PM 发表
我比较常用string


通常是 string , integer , boolean , double  其他 很少用到
作者: goodhermit95    时间: 2008-7-20 06:36 PM
标题: 回复 #17 goodday 的帖子
我不管什么都用string
不能换interger
作者: dious    时间: 2008-7-20 08:29 PM
我在java也用到String和integer
作者: goodday    时间: 2008-7-21 02:00 AM
原帖由 goodhermit95 于 2008-7-20 06:36 PM 发表
我不管什么都用string
不能换interger


string 要转 integer

dim a as string = "123"
cint(a)
or
ctype(a , integer)
作者: goodday    时间: 2008-7-21 02:00 AM
c# 的

int.parse(a);
作者: ★笨☆天使    时间: 2008-7-21 07:23 PM
半懂半不懂
我完全不会vb/c#/c++的
只是想学就下载了vb来看看
到现在什么都还写不出
只懂if,than,else
可是不懂怎样用

[ 本帖最后由 ★笨☆天使 于 2008-7-21 07:57 PM 编辑 ]
作者: dious    时间: 2008-7-21 07:54 PM
原帖由 goodday 于 2008-7-21 02:00 AM 发表
c# 的

int.parse(a);

parse是什么意思呢         
·
作者: goodday    时间: 2008-7-21 07:56 PM
变成 或 归类
作者: dious    时间: 2008-7-21 08:10 PM
想起來了
java是
parse.int




欢迎光临 JBTALKS.CC (https://mobile.jbtalks.cc/) Powered by Discuz! X2.5