Structure

bryan

Member
Joined
Jul 17, 2004
Messages
11
Programming Experience
Beginner
How do you define a structure. I am using this code
VB.NET:
 Structure PhoneList 
 
End Structure
but it is underlining PhoneList and when I put the pointer over it, it reads.

Structure 'PhoneList' must contain at least one instance member variable or Event Declaration



Anyone know why I am getting this?
 

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,524
Location
Lansing, MI; USA
Programming Experience
10+
yes, a structure must contain at least one item such as:

VB.NET:
Private Structure udsPhoneList    (uds is short for User Defined Structure)
   Dim Name as Stirng
   Dim Number as String
End Structure

now to use this defined structure on your form or in a module simply declare a variable as the structure such as

VB.NET:
Private MyPhone as udsPhoneList

With MyPhone
  .Name = "Bob Smith"
  .Number="(555) 555-5555"
End With
and whatnot... have fun :)
 
Last edited:
Top Bottom