FindObject Function

允許透過物件名稱作為字串參數,在執行階段對物件進行尋址。

例如,以下指令:


MyObj.Prop1.Command = 5

與以下指令區塊相對應:


Dim ObjVar as Object
Dim ObjProp as Object
ObjName As String = "MyObj"
ObjVar = FindObject( ObjName As String )
PropName As String = "Prop1"
ObjProp = FindPropertyObject( ObjVar, PropName As String )
ObjProp.Command = 5

這樣即可在執行階段動態地建立名稱。例如:

"TextEdit1" to "TextEdit5" in a loop to create five control names.

另請參閱:FindPropertyObject

語法


FindObject( ObjName As String )

參數:

ObjName:字串,用於指定執行階段要尋址的物件之名稱。

錯誤代碼:

5 無效的程序呼叫

12 未定義的變數

Please support us!