看板 Visual_Basic 關於我們 聯絡資訊
Dim i, Result ,MyArray, Name Name ="X" MyArray = Array("A", "B", "C", "D") Result = Filter(MyArray, Name , True) MsgBox UBound(Result) 請問為什麼X不包含在陣列值,結果會是-1 (值不在陣列中,不是UBound(0)=0嗎?)? 若, Name = "D" Result = Filter(MyArray, Name , True) 則MsgBox UBound(Result) 為什麼有在陣列的值,結果會是0呢 (值在陣列中,不是UBound(1)=1嗎?)? 其實主要是想寫若 Name的值在陣列中,則會回傳訊息顯示"正常運作" 若不在陣列中,則會回傳訊息"錯誤" 再麻煩指導,感謝~ -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.241.172.129 ※ 文章網址: https://www.ptt.cc/bbs/Visual_Basic/M.1448461431.A.9C9.html ※ 編輯: Fmajor (111.241.172.129), 11/26/2015 02:10:59
johnpage: Filter的定義 11/26 06:34
peakhour: ubound 返回的不是個數,而是index 12/02 01:26
Fmajor: 感謝提醒,已經知道哪邊錯誤了,謝謝兩位大大 12/06 00:32