廣告廣告
  加入我的最愛 設為首頁 風格修改
首頁 首尾
 手機版   訂閱   地圖  簡體 
您是第 11294 個閱讀者
 
發表文章 發表投票 回覆文章
  可列印版   加為IE收藏   收藏主題   上一主題 | 下一主題   
ziele 手機
個人文章 個人相簿 個人日記 個人地圖
初露鋒芒
級別: 初露鋒芒 該用戶目前不上站
推文 x1 鮮花 x32
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片
推文 x0
[.Net][求助] 從vb6到vb.net type (Structure)要如何寫??
想要把vb6寫的程式改到vb.net 可是會出錯下面的錯誤

Public Const c1 = 255
Public Const c2 = 255
Public Const c3 = 15

Public sss(0 To c1) As sta

Structure ppp
Dim X As Integer
Dim Y As Integer
Dim Alarm As String
Dim Gif As String
End Structure

Structure hhh
Dim H_Addr As String
Dim H_Name As String
Dim H_Memo As String
Dim H_Pic As String
Dim H_Mobile As String
Dim H_Mail As String
<VBFixedArray(c3)> Dim Point() As ppp

Public Sub Initialize()
R ..

訪客只能看到部份內容,免費 加入會員 或由臉書 Google 可以看到全部內容




獻花 x0 回到頂端 [樓 主] From:臺灣臺北市 | Posted:2009-02-26 21:56 |
Lenki
數位造型
個人文章 個人相簿 個人日記 個人地圖
小人物
級別: 小人物 該用戶目前不上站
推文 x0 鮮花 x10
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

在 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


獻花 x0 回到頂端 [1 樓] From:臺灣中華 | Posted:2009-03-29 02:14 |

首頁  發表文章 發表投票 回覆文章
Powered by PHPWind v1.3.6
Copyright © 2003-04 PHPWind
Processed in 0.021464 second(s),query:16 Gzip disabled
本站由 瀛睿律師事務所 擔任常年法律顧問 | 免責聲明 | 本網站已依台灣網站內容分級規定處理 | 連絡我們 | 訪客留言