分享:
▲
在 VB.NET 裡的 Structure 並沒有辦法使用 Initialize() 來初始設定, 若一定要使用類似 Initialize的方式,請宣告成類別。
使用Structure則可以如下面的方式初始陣列: Public Const c1 = 255 Public Const c2 = 255 Public Const c3 = 15
Structure ppp 記得將 dim 改public public X As Integer End Structure
Structure hhh public Point() As ppp End Structure
Structure sta Public Home() As hhh End Structure
Public Sub InitRegData() 初始化陣列大小 dim sss(c1) as sta for i as integer=0 to c1 redim sss(i).Home(c2) for j as integer=0 to c2 redim sss(i).Home(j).Point(c3) next next 初始化陣列大小完成 下面再接你要處理、執行的程式碼…… …… ……
End Sub
|