Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Variant Data Type

Posted on 2004-04-05
4
Medium Priority
?
268 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 500 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

715 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