把“...”替換成你要初始化的數(shù)據(jù)。一個(gè)簡(jiǎn)單的例子: Dim a(3) As Integer = { 0, 1, 2 }**修改**既然有界數(shù)組不能初始化,就還缺(省)界數(shù)組試試嘛: Dim a() As Integer = { 0, 1, 2 } 類(lèi)型不匹配的錯(cuò)誤估計(jì)是你的結(jié)構(gòu)體缺少構(gòu)造函數(shù)造成的。在你的quality_i結(jié)構(gòu)體定義里面加一個(gè)構(gòu)造函數(shù),如下所示 Public Structure quality_i Public nub As Integer Public nae As String Public Sub New(ub As Integer, ae As String)nub = ubnae = aeEnd SubEnd Structure 然后以如下方式初始化: Dim k() As quality_i = {
泊頭網(wǎng)站建設(shè)公司成都創(chuàng)新互聯(lián),泊頭網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為泊頭上1000家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站建設(shè)要多少錢(qián),請(qǐng)找那個(gè)售后服務(wù)好的泊頭做網(wǎng)站的公司定做!
Module Module1
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
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
也可聲明為字符串?dāng)?shù)組
數(shù)組好像沒(méi)有快速賦值吧,或者你再把問(wèn)題再清楚一點(diǎn)。
語(yǔ)句執(zhí)行時(shí)間倒是可以做到。在語(yǔ)句前
Dim oldTime As Date = Now
在過(guò)程語(yǔ)句后加
Dim newTime As Date = Now
Dim differenceInSeconds As Long = DateDiff(DateInterval.Second, oldTime, newTime)
textbox1.text= "共用了:" differenceInSeconds "秒!"