O'Reilly logo

Microsoft® Visual Basic® 2010 Developer’s Handbook by Klaus Löffelmann and Sarika Calla Purohit

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Simplified Access to Object Properties and Methods Using With ... End With

By using With ... End With, you can include a number of elements (properties, methods) of an object within a code block repeatedly without to the need to name the object name each time anew. When the fully-qualified name for the corresponding object variable is very long, With ... End With can be used not only to save keystrokes, but also to enhance performance. At the same time, you lower the risk of misspelling one of its elements.

For example, if you’d like to use several different properties of a single object, write the statements for property assignments into a With ... End With structure. When you do this, you no longer need to point to the object in each property ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required