网站建设资讯

NEWS

网站建设资讯

vb.net数组赋值语法 vbs数组赋值

vb.net 数组 赋值

Module Module1

成都创新互联主要从事网站设计、成都网站制作、网页设计、企业做网站、公司建网站等业务。立足成都服务鸡西,10多年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:028-86922220

Sub Main()

Dim i, k As Integer

Dim a(,) As Integer = {{1, 2}, {2, 4}, {3, 4}}

For i = 0 To 2

For k = 0 To 1

Console.Write("a({0},{1})={2} ", i, k, a(i, k))

Next

Console.WriteLine()

Next

Console.Read()

End Sub

End Module

vb.net 怎么使用指针对数组快速赋值赋值

数组好像没有快速赋值吧,或者你再把问题再清楚一点。

语句执行时间倒是可以做到。在语句前

Dim oldTime As Date = Now

在过程语句后加

Dim newTime As Date = Now

Dim differenceInSeconds As Long = DateDiff(DateInterval.Second, oldTime, newTime)

textbox1.text= "共用了:" differenceInSeconds "秒!"

vb.net数组如何赋值

Dim abc(2) As Integer

abc = {0, 1, 2}

'或者

Dim abcd() As Integer

ReDim abcd(9)

For i As Integer = 0 To abcd.Length - 1

abcd(i) = i

Next

也可声明为字符串数组

vb中怎么赋值给数组?

vb赋值给数组,有以下几种方式:

第一种方式:

Private Sub Command1_Click()

Dim a(10) As Integer '定义数组a,下标最大值为10

For i = 0 To 10

a(i) = i'这里可以直接给数组赋值了

Print "a(" i ")的值" a(i) '打印数组

Next

End Sub

第二种方式:

Private Sub Command1_Click()

Dim a() As Integer '定义数组a,这里未设置下标

For i = 0 To 10

ReDim Preserve a(i)'ReDim 语句改变数组的元素以及维数的数目

a(i) = i'这里可以直接给数组赋值了

Print "a(" i ")的值" a(i)

Next

End Sub

第三种方式:

Private Sub Command1_Click()

a = Array(1, 5, 2, 43, 222)

MsgBox "a(0)原来的值是:" a(0)

a(0) = 100

MsgBox "a(0)赋值后的值是:" a(0)

End Sub

vb.net 数组赋值

Dim n, i, j As Integer

'这里你用的是默认的值,所以N是0,这样,下面的那句话就成了

Dim a(n - 1, n - 1) As Long

'Dim a(0-1,0-1) As Long 也就是 Dim a(-1,-1) As Long

以后调用的时候肯定会出错

vb.net数组赋值

Dim x(8, 8)

Dim a As Integer

Dim b As Integer

b = 0

For i = 0 To 8

For j = 0 To 8

If b = 3 Then

b = 1

a = a + 1

Else

b = b + 1

End If

x(i, j) = aNext

Next


网站名称:vb.net数组赋值语法 vbs数组赋值
转载来源:http://cdweb.net/article/hphioh.html