Solved

Data structure in VB .NET

Posted on 2004-08-13
7
1,098 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
[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
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

635 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