Solved

Data structure in VB .NET

Posted on 2004-08-13
7
1,083 Views
Last Modified: 2012-08-13
Hi,
   As i am new to VB .NET (I am used to c/c++ environment) i have a quick question on data structures.
Somehow i started off with VB .NET and now i have to import an external dll into my VB application and also read data off of that dll's output buffer.
The dll writes an integer to the buffer every time and i need to read it based on some condition.

If the dll returns each of the members of this data structure,  i need to find the following
corresponding functionality in VB .NEt

if(out.value1 == 1)
{
//do this
buffer1 = out.value2;
buffer2 = out.value3;
//etc
}
else if(out.value1 == 2)
{
//do this
//nothing here
}


===============
struct
{
int value1;
int value2;
int value3;
} out;

===============

Please help me as soon as possible,
thanks,
Sang
0
Comment
Question by:sanggeek
  • 3
7 Comments
 
LVL 27

Expert Comment

by:Dabas
ID: 11797786
Hi sanggeek:
I fear you have asked your question in the wrong area.
Your code looks like C# not Visual Basic.
I suggest you ask at Community Support to move the question to either the .NET or the C# areas

Dabas
0
 

Author Comment

by:sanggeek
ID: 11797820
dabas,
     my sample code is indeed of C form. i am looking to achieve that functionality in VB .NET and i am sure its possible, just not sure how. I dont have MSDN support also.

thanks,
Sang
0
 
LVL 27

Expert Comment

by:Dabas
ID: 11797839
struct
{
int value1;
int value2;
int value3;
} out;

Try:

Type
    value1 as Integer
    value2 as Integer
    value3 as integer
End Type

0
 
LVL 27

Accepted Solution

by:
Dabas earned 70 total points
ID: 11797845
Correction:

Type outType
    value1 as Integer
    value2 as Integer
    value3 as integer
End Type

Then your code:

Dim out as New outType
If out.value1 = 1 then
    buffer1 = out.value2
    buffer2 = out.value3
    'etc
ElseIf out.value1 = 2 then
    'do this
    'nothing here
End If
0
 
LVL 37

Assisted Solution

by:gregoryyoung
gregoryyoung earned 70 total points
ID: 11800878
StructDeclaration ::=
[ Attributes ] [ StructModifier+ ] Structure Identifier LineTerminator
   [ TypeImplementsClause+ ]
   [ StructMemberDeclaration+ ]
   End Structure LineTerminator

StructureModifier ::= AccessModifier | Shadows


so ...


public structure foo
    public value1 as integer
    public value2 as integer
    public value3 as integer
end structure


0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

895 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now