Computing.Net > Forums > Programming > How declare structs in VB?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

How declare structs in VB?

Reply to Message Icon

Name: Carlos Meyer
Date: September 5, 2004 at 19:52:43 Pacific
OS: Windows XP
CPU/Ram: Duron 1600 / 512
Comment:

I´ve created a dll using C and now I want to access the dll functions from my exe created in VB. I dont have problems with functions with simples parameters like int and double, but I dont know how to deal with structs.
How can I deal with these issues?


Aloha!



Sponsored Link
Ads by Google

Response Number 1
Name: egkenny
Date: September 5, 2004 at 20:50:02 Pacific
Reply:

You did not say which versions of VB you are using.
VB 6.0 has Type to declare structures
VB.NET has Structure to declare structures
VB.NET has Class to declare classes

Examples:

Visual Basic 6.0
----------------

Private Type Employee
GivenName As String
FamilyName As String
Extension As Long
Salary As Currency
End Type

VB.NET
------

Private Structure Employee
Public GivenName As String
Public FamilyName As String
Public Extension As Long
Private Salary As Decimal
Public Sub GiveRaise(Raise As Double)
Salary *= Raise
End Sub
Public Event ReviewTime()
End Structure


Private Class Employee
Public GivenName As String
Public FamilyName As String
Public Extension As Long
Private Salary As Decimal
Public Sub GiveRaise(Raise As Double)
Salary *= Raise
End Sub
Public Event ReviewTime()
End Class



0

Response Number 2
Name: Carlos Meyer
Date: September 5, 2004 at 21:35:04 Pacific
Reply:

Thank you very much! Im using VB 6.0...
thats all I needed.
Thanks. :)

Aloha!


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: How declare structs in VB?

Declaring Variables in VB 6.0 www.computing.net/answers/programming/declaring-variables-in-vb-60/9957.html

How to delete in VB.NET www.computing.net/answers/programming/how-to-delete-in-vbnet/14490.html

how to get the number of table in VB?? www.computing.net/answers/programming/how-to-get-the-number-of-table-in-vb/2239.html