Skip to Content
VB.NET Language in a Nutshell, Second Edition
book

VB.NET Language in a Nutshell, Second Edition

by Steven Roman PhD, Ron Petrusha, Paul Lomax
April 2002
Intermediate to advanced
688 pages
19h 51m
English
O'Reilly Media, Inc.
Content preview from VB.NET Language in a Nutshell, Second Edition

Name

Structure...End Structure Statement

Syntax

                  accessmodifier Structure StructureName 
   [Implements interfacenames]
   variable declarations
   procedure declarations
End Structure
accessmodifier (optional; Keyword)

The possible values of accessmodifier are Public, Private, Friend, Protected, Protected Friend. For more information, see Section 4.7 in Chapter 4.

Implements interfacenames (optional)

Indicates that the structure implements the members of one or more interfaces

Description

Used to declare user-defined types. Structures are similar to classes, but they are value types rather than reference types.

Rules at a Glance

  • The members of a structure can be variables, properties, methods, or events. Note, however, that each member must be declared with an access modifier: Public (or Dim), Private, or Friend.

  • You cannot assign a structure member an initial value at the same time as you declare it. As a result, the following Structure construct is illegal:

    Structure Point
       Public x As Integer = 0       ' Illegal
       Public y As Integer = 0       ' Illegal
    End Structure
  • Structure members can be other structures or objects.

  • If a structure member is an array, it cannot be explicitly dimensioned.

  • Structures can be passed as arguments to functions or as the return type of a function.

  • Although structures are similar to classes, the following class features are not supported in structures:

    • Structures cannot explicitly inherit, nor can they be inherited.

    • All constructors for a structure must be parameterized.

    • Structures ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

VB .NET Language in a Nutshell

VB .NET Language in a Nutshell

Steven Roman PhD, Ron Petrusha, Paul Lomax

Publisher Resources

ISBN: 0596003080Supplemental ContentCatalog PageErrata