|
-
Jun 28th, 2004, 03:56 AM
#1
Thread Starter
New Member
can we have data types for C structs and union in VB
Hi
I am having this structure in VC, can I have the same data type in VB, and how it will look like
Thanks
struct trevariant_struct {
short NullInd;
Long TreType;
union trevariant_datatype {
long VLong;
double VDouble;
char *VString;
TRE_BLOBVALUE VBlob;
struct trearray_struct {
long Size; /* Size of array */
TRE_VARIANT *Elements; /* Array of elements */
} VArray;
struct trehash_struct { /* All TRE_HASH types */
long Size; /* Number of values in hash */
TRE_HASHVALUE *Elements; /* Array of key value pairs in hash */
} VHash;
} Data;
};
Last edited by vipingverma; Jun 28th, 2004 at 07:18 AM.
-
Jun 29th, 2004, 05:16 AM
#2
Lively Member
Hi
You can use a Type declaration as a part of struct. Like...
Type <TypeName>
Members Declaration
Members Declaration
Members Declaration
-------
End Type
There's no concept of Unions in VB.
Gs
-
Jun 29th, 2004, 05:23 AM
#3
Banned
VB Code:
Private Type tVals
Val as Long
Loc as POINTAPI
End Type
Private Type tSys
strName$
Vals() as tVals 'dynamic UDT array
End Type
-
Jun 29th, 2004, 05:23 AM
#4
Thread Starter
New Member
Thanks for the response, so that means we cant map this data structure in VB ?
VB Code:
struct trevariant_struct {
short NullInd;
Long TreType;
union trevariant_datatype {
long VLong;
double VDouble;
char *VString;
TRE_BLOBVALUE VBlob;
} Data;
};
-
Jun 30th, 2004, 10:51 AM
#5
I used the VB Type but I wasn't able to pass it around the whole project for some reason. Instead I just made a class.
This is 2004 - forget structs - use a class
-
Jun 30th, 2004, 12:01 PM
#6
Originally posted by Dave Sell
I used the VB Type but I wasn't able to pass it around the whole project for some reason ...
If you did not declare it as Public at the MODULE level then you obviously won't be able to ...
-
Jun 30th, 2004, 12:59 PM
#7
Yes it was Public - it just wouldnt pass around to all parts of the code when Passing as an argument ByVal.
-
Jun 30th, 2004, 10:54 PM
#8
Thread Starter
New Member
Parallel of C struct?Union in VB
Hi
I am not getting the meaning of replies, I have a dll for which source code is not available to me and it expects a struct as parameter which internally has union inside ( Data structure I have already posted), now is in VB is there any way to create a data structure like this C structure
Last edited by vipingverma; Jul 1st, 2004 at 10:34 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|