vb中, Dim是指的是什么意思?

有没有人在啊,想请教一下,vb中, Dim是指的是什么意思?
最新回答
她ゝ那么高傲

2025-06-27 06:31:54

Dim是Dimension的缩写,是在VB中是定义函数时用到的,这个语句就是创立一个新的变量,后面要加上所需变量的名字,格式为Dim<变量名>As<数据类型>。

As为变量指定类型,运行时,Dim语句就根据变量类型为变量分配内存空间。

例如:Dim a As Integer 定义一个整型变量,变量名为a。

扩展资料:

Visual Basic 编译器使用Dim语句来确定变量的数据类型和其他信息,例如哪些代码可以访问该变量。 

例:声明一个变量以保存Integer值。

VB

Dim numberOfStudents As Integer  

例:声明过程、 块、 类、 结构或模块中的变量

VB 

Public maximumAllowed As Double

Protected Friend currentUserName As String

Private salary As Decimal

Static runningTotal As Integer

参考资料:

百度百科-Visual Basic