Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / COM / October 2003



Tip: Looking for answers? Try searching our database.

How to read the safearray in vb???

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ramesh - 31 Oct 2003 06:31 GMT
Hi,
I have developed one COM component using ATL .One of my interface method
returns Varaiant .Variant contains array of VT_BSTR packed using safearray.
How to read the safe array in vb.
VC++: GetParams(VARIANT *varTemp)

SAFEARRAY *psaAttribute;
SAFEARRAYBOUND aDim[1];
long lIndice;
BSTR bstrTemp;
aDim[0].cElements = 3;//no of coloums.
aDim[0].lLbound   = 0;
psaAttribute =NULL;
psaAttribute = SafeArrayCreate(VT_VARIANT,1,aDim);
(bstrTemp) =  SysAllocString(L"New variable");
VARIANT varTemp;
VariantInit(&varTemp);
varTemp.vt = VT_BSTR|VT_BYREF;
varTemp.pbstrVal = &bstrTemp ;
lIndice = 0;
SafeArrayPutElement(psaAttribute,&lIndice,&varTemp);
varArray->vt = VT_ARRAY|VT_VARIANT;
varArray->parray = psaAttribute;

.How to read this safearray in vb????
Thanks In Adavance!!!!!
Regards,
Ramesh.
Eduardo A. Morcillo [MS MVP] - 31 Oct 2003 16:00 GMT
You don't have to do anything special. VB uses SAFEARRAY for its arrays.
Once you have the Variant in the VB side, use it like an array.

Signature

Eduardo A. Morcillo [MS MVP]
http://www.mvps.org/emorcillo

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.