Solved

Variant Data Type

Posted on 2004-04-05
4
255 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

752 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