Solved

Variant Data Type

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

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…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

785 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