Passing Structures to Methods

Structures can be passed to methods as arguments. For example, consider the following method that simulates an order processing taking an instance of the previously shown Order structure:

image

You can then simply invoke the method passing the desired instance as follows:

Dim firstOrder As New Order(1, Date.Now, Date.Now, 1, 1) ShowOrderInfo(firstOrder)

The preceding code produces an output that looks like this:

ID: 1, Date received: 08/19/2009 23:41:37

Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.