Module Module1 'declare a struct named Colour Public Structure Colour 'Properties Public Property Red As Integer Public Property Green As Integer Public Property Blue As Integer 'Constructor Public Sub New(ByVal rVal As Integer, ByVal gVal As Integer, ByVal bVal As Integer) Red = rVal Green = gVal Blue = bVal End Sub 'Display the Struct as a String Public Overrides Function ToString() As String Return String.Format("{0}, {1}, {2}", Red, Green, Blue) End Function End Structure Public Class Tester Public Sub Run() 'Create an instance of the struct 'where red=100, green=50 and blue=250 Dim colour1 As Colour = New Colour(100, 50, 250) 'Display the values in the struct Console.WriteLine("Colour1 Initialized using the non-default constructor: ") Console.WriteLine("colour1 colour: {0}", colour1) Console.WriteLine() 'Invoke the default constructor Dim colour2 As Colour = New Colour() Console.WriteLine("Colour2 Initialized using the default constructor: ") Console.WriteLine("colour2 colour: {0}", colour2) Console.WriteLine() 'Pass the struct to a method MyMethod(colour1) 'Redisplay the values in the struct Console.WriteLine("Colour1 after calling the method 'MyMethod': ") Console.WriteLine("colour1 colour: {0}", colour1) Console.WriteLine() End Sub 'Method takes a struct as a parameter Public Sub MyMethod(ByVal col As Colour) 'Modify the values through the properties col.Red = 200 col.Green = 100 col.Blue = 50 Console.WriteLine("colour values from inside the 'MyMethod' method: {0}", col) Console.WriteLine() End Sub End Class Sub Main() Dim t As Tester = New Tester() t.Run() Console.ReadLine() End Sub End Module