Solved

Data structure in VB .NET

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

708 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

11 Experts available now in Live!

Get 1:1 Help Now