Sams Teach Yourself Visual Basic 6 in 24 Hours

Sams Teach Yourself Visual Basic 6 in 24 Hours

By Greg Perry

Q&A

  1. Why are collections better than arrays?

    Collections are not better than arrays in all cases. If you need to keep track of 100 integer temperature values, keep those values in an integer array. The array is efficient and you can work with the array using loops as you are used to doing. A collection is nice when you don't know how many items will appear in the group, especially when those items are objects such as controls and not simply regular datatypes. The collection can grow to any size and the methods you use on the collection make for easy programming because you don't have to keep track of the highest item in the collection yourself.

  2. What is the real difference between OLE and OLE automation?

    OLE lets users edit objects from other applications inside a Form window. The cross-application platforms that OLE provides let you embed a Paint object in your application without having to code drawing methods that perform as Paint objects perform. Before OLE automation, however, regular OLE did not give your Visual Basic application the capability to control the serving application. Applications that support OLE automation can now expose all their internal properties, events, and methods (if they're not OLE automation compatible, they will have no properties, events, or methods) to applications such as Visual Basic. Visual Basic, therefore, can make Access manipulate database tables or make Excel manipulate a named range in a worksheet. Although you must do some extra work on the front end to code the OLE automation, your applications become much more powerful because they borrow technology from these other applications.

Share ThisShare This

Informit Network