Set up event handlers through reflection
Reflection makes it easy to invoke a method (or assign a field or aproperty) by its name. For example, suppose you have the following classes: Class Person Event PropertyChanged(ByVal propertyName
Reflection makes it easy to invoke a method (or assign a field or aproperty) by its name. For example, suppose you have the following classes: Class Person Event PropertyChanged(ByVal propertyName
‘ This code is taken from Francesco Balena’s’ “Programming Microsoft Visual Basic .NET” – MS Press 2002, ISBN 0735613753′ You can read a free chapter of the book at ‘
In VB.NET you can create what in C is called a union, i.e. a particular structure where you can access the same memory with different names. Here’s how you declare
‘ A reusable function that merges two ArrayList objects’ Example:’ Dim al As New ArrayList()’ al.Add(“Jack”)’ al.Add(“Mary”)’ val.Add(“Bob”)’ al.Add(“Tom”)’ ‘ Dim al2 As New ArrayList()’ al2.Add(“Frank”)’ al2.Add(“Lee”)’ al2.Add(“Nick”)’ ‘ al
‘ A generic routine that deletes an element in any type of array.’ Example: deleting the 2nd element of the array arr’ ArrayDeleteElement(arr, 1) Sub ArrayDeleteElement(ByVal arr As Array, ByVal
‘ A generic routine that inserts an element in any type of array.’ Example: inserting an entry of value 5 between the 1st and 2nd entry of the ‘ array
As explained in the tip about the ARGBColor structure (look at the end of this tip for the link), we can define a structure and have its fields that point
You can use the technique for an “undo” menu/toolbar option. Use a collection instead of a listbox to reduce overhead. Support for both LIFO and FIFO is also included: Public