Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,24 @@ You begin a structure declaration with the [Structure Statement](../../../langua
salary *= raise
End Sub
Public Event salaryReviewTime()

' Method to raise the event
Public Sub TriggerSalaryReview()
RaiseEvent salaryReviewTime()
End Sub
End Structure
```

The `salary` field in the preceding example is `Private`, which means it is inaccessible outside the structure, even from the containing class. However, the `giveRaise` procedure is `Public`, so it can be called from outside the structure. Similarly, you can raise the `salaryReviewTime` event from outside the structure.

The `salary` field in the preceding example is `Private`, which means it is inaccessible outside the structure, even from the containing class. However, the `giveRaise` procedure is `Public`, so it can be called from outside the structure. Similarly, you can raise the `salaryReviewTime` event indirectly by calling a method within the structure that raises it. For example:

```vb
Public Sub TriggerSalaryReview()
RaiseEvent salaryReviewTime()
End Sub
```

This allows you to control how and when the event is raised while keeping the event inaccessible directly from outside the structure.

In addition to variables, `Sub` procedures, and events, you can also define constants, `Function` procedures, and properties in a structure. You can designate at most one property as the *default property*, provided it takes at least one argument. You can handle an event with a [Shared](../../../language-reference/modifiers/shared.md)`Sub` procedure. For more information, see [How to: Declare and Call a Default Property in Visual Basic](../procedures/how-to-declare-and-call-a-default-property.md).

## See also
Expand Down
Loading