Sub Procedures or Functions in Visual Basic

Sub Procedures or Functions in Visual Basic

Is it possible to have subprocedures or subfunctions in Visual Basic?For example, in COM components we find properties being accessed using the following:

myObject.Column("myColumn").Hide = True

In this Column is a function with a hide property. Is it possible in Visual Basic to write such functions, and if it is possible, how to write them

Yes it is possible. It is accomplished by having a property return an object as its value. So using your example the Column property of MyObject actually returns a Column object, allowing the client of the object to get the object and set one of its properties in one line of code.

What we are discussing here is creating an object model in which the top level object is used to access its child objects.


Share the Post: