Solved

Data structure in VB .NET

Posted on 2004-08-13
7
1,094 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
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 …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

685 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