
正文
vb.net+数组类型,vb中数组的定义
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
vb.net 数组的定义方法
1、vb.net的
数组定义与变量定义差不多。可以用
dim
来定义
比如:
dim
a(100)
as
integer。
也可以不定义下标
在程序中
用
redim
来定义。
如:
dim
a()
as
integer
'
'
redim
a(100)
2、vb.net中定义数组可以直接赋值。
如:
dim
a()
as
integer
={1,
2,
3,4}
相关问答
Q1: vb.net数组型转换为数字型
Dim byts1() As Byte = {255, 255, 0, 0}
'4位16进制数组转Integer
Dim value As Integer = BitConverter.ToInt32(byts1, 0)
'Integer转4位16进制数组()
Dim byts2() As Byte = BitConverter.GetBytes(value)
Q2: vb.net 如何将字符串转换为integer类型的数据?
1、int类型数组转换为Integer类型的数组。
2、long类型数组转换为Integer类型的数组。
3、char类型数组转换为Integer类型的数组。
4、String类型数组转换为Integer类型的数组。
5、double类型数组转换为Integer类型的数组。
Q3: vb.net在数组定义中如何使用复合数据类型
你可以用结构数组的,如下:
...
Private Structure test
Dim name As String
Dim sex As String
Dim age As Integer
Dim salary As Integer
End Structure
Dim list(2) As test
Private Sub insert()
list(0).name = "张三"
list(0).age = "20"
list(0).salary = "1500"
list(0).sex = "男"
list(1).name = "李四"
list(1).age = "21"
list(1).salary = "1500"
list(1).sex = "女"
End Sub
...
你可以放到main()里输出一下,就是这样...






