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
Solved

Data structure in VB .NET

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

Suggested Solutions

Title # Comments Views Activity
start a process from a service 3 33
Help with opening combobox using VB.NET. 3 26
"Emulate" TAB key when press Enter Key 3 48
VB.NET Textbox input validation 4 40
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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

829 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