Solved

Variant Data Type

Posted on 2004-04-05
4
259 Views
Last Modified: 2008-02-01
I have a need to dimension an array as a variant array to be accepted by an older ActiveX server application that I'm using. Since the Variant data type is no longer supported what can I pass the the server to 'trick it' into thinking it's receiving a variant array?
0
Comment
Question by:thenrich
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 10761392
Pass it as Object.

AW
0
 
LVL 5

Author Comment

by:thenrich
ID: 10765164
I tried that - no success...
0
 
LVL 7

Accepted Solution

by:
ScrptMasta earned 125 total points
ID: 10766383
In Visual Basic 6.0, Variant serves as the universal data type. This means that you can store data of any type in a variable of type Variant.

In Visual Basic .NET, Object is the universal data type. A variable of type Object can hold data of any type. The Variant type is not supported, and all its functionality is supplied by Object.

Variant is still a reserved word in Visual Basic .NET, even though it has no syntactical use. This helps avoid confusion with its former meanings.

The VarType function returns a member of the VariantType enumeration that provides the data type classification of an object variable. You can also use classes in the System namespace to obtain numeric data type information for an Object instance.

Ex.

Dim SomeObj As Object
' ... ... ... ...  SomeObj is assigned some value during processing.
' ... ... ... ...  Now we want to find out the data type of SomeObj.
Dim Dtype As Integer      ' To hold numeric data type result.
Dtype = Type.GetTypeCode(SomeObj.GetType())
0
 
LVL 12

Expert Comment

by:farsight
ID: 10768227
This is an excellent resource for all issues related to interop:
  http://www.dotnetinterop.com/

Microsoft realized many developers were having issues with interop, so they created this site just for related issues.

---
I think you guys are missing that thenrich is trying to pass a variant array, that is say, an array of variants.  The problem is not what single object to pass, but what parts should the object be composed of in order to marshall to a VB6 array of variants.

Is that correct, thenrich?
---
thenrich,
You may need to determine how the array of variants is represented in memory, and then to something like in this article:

"How do I call a function that returns a pointer to an array of structures?"
http://www.dotnetinterop.com/faq/?q=CalleeAllocatedStructArray
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question