How to pass UDT array from excel vba to vb.net -
how pass array of user defined class type byref excel vba vb.net? have similar post deals passing double arrays here , tried using same method udt doesn't work. ideas?
sorry answer own question (again) similar other question linked in question, able accomplish in same way answer other question. had change of refraction parameters around.
in vb.net code take in parameter object, object's type (which recognizes object() array) , direct cast object array desired class array using following function in vb.net
friend function comobjectarraytopointarray(byval comobject object) point() dim thistype type = comobject.gettype dim fibtype type = type.gettype("system.object[]") dim fibarray(0) point if thistype fibtype dim args(0) object dim numentries integer = cint(thistype.invokemember("length", bindingflags.getproperty, _ nothing, comobject, nothing)) redim fibarray(numentries - 1) j integer = 0 numentries - 1 args(0) = j fibarray(j) = directcast((thistype.invokemember("getvalue", bindingflags.invokemethod, _ nothing, comobject, args)), point) next end if return fibarray end function
Comments
Post a Comment