Dim abc(2) As Integer
成都網(wǎng)站制作公司哪家好,找創(chuàng)新互聯(lián)建站!從網(wǎng)頁設(shè)計、網(wǎng)站建設(shè)、微信開發(fā)、APP開發(fā)、成都響應(yīng)式網(wǎng)站建設(shè)等網(wǎng)站項目制作,到程序開發(fā),運營維護。創(chuàng)新互聯(lián)建站于2013年創(chuàng)立到現(xiàn)在10年的時間,我們擁有了豐富的建站經(jīng)驗和運維經(jīng)驗,來保證我們的工作的順利進行。專注于網(wǎng)站建設(shè)就選創(chuàng)新互聯(lián)建站。
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ù)組
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
for i =0 to ...
for j =0 to ...
keyarray(i,j)=
next
next
雙重循環(huán),賦值和讀取一樣
當(dāng)然可以的,需要System.Runtime.InteropServices?命名空間中的?Marshal?類
Imports?System.Runtime.InteropServices?'這里一定要有?
Public?Class?Form1
Public?Structure?m_Point
Dim?x?As?Integer
Dim?y?As?Integer
End?Structure
Private?Sub?Button1_Click(ByVal?sender?As?System.Object,?ByVal?e?As?System.EventArgs)?Handles?Button1.Click
Dim?i?As?Integer?=?50
Dim?ai()?As?Integer?=?{1,?2,?3,?4,?5}
Dim?pi?As?IntPtr?=?GCHandle.Alloc(i,?GCHandleType.Pinned).AddrOfPinnedObject()?'取得整形變量的指針?
Dim?pai?As?IntPtr?=?GCHandle.Alloc(ai,?GCHandleType.Pinned).AddrOfPinnedObject()?'取得整形數(shù)組首地址指針
MsgBox(Marshal.ReadInt32(pi,?0))?'讀回整形變量指針指向的值
MsgBox(Marshal.ReadInt32(pai,?0?*?4))?'讀回數(shù)組的第一個元素
MsgBox(Marshal.ReadInt32(pai,?1?*?4))?'讀回數(shù)組的第二個元素
MsgBox(Marshal.ReadInt32(pai,?2?*?4))?'讀回數(shù)組的第三個元素
'-----下面是結(jié)構(gòu)--------------------------
Dim?m_p?As?New?m_Point
m_p.x?=?100
m_p.y?=?50
Dim?pm_p?As?IntPtr?=?GCHandle.Alloc(m_p,?GCHandleType.Pinned).AddrOfPinnedObject()?'取得結(jié)構(gòu)首地址指針?
MsgBox(Marshal.ReadInt32(pm_p,?0?*?4))?'讀回結(jié)構(gòu)的第一個值
MsgBox(Marshal.ReadInt32(pm_p,?1?*?4))?'讀回結(jié)構(gòu)的第二個值
End?Sub
End?Class