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.

See also  Small Business Strategies with Venmo

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist