Interviewer Insights  
About Us  
Comments, Suggestions  
  or General Feedback  
Interested in writing for  
Tech Talk Tips?  

 

 


Application Developer
Intrinsic Collections in Visual Basic 6
by Mark Horninger


Here is a question to evaluate the Visual Basic knowledge of a junior to mid level programmer. A programmer with 6 months of experience should be able to identify at least 2 of the 3 parts of this question.

What are the 3 intrinsic (built in) collections in Visual Basic?

The three intrinsic collections are forms, controls and printers. Many candidates may forget about the printers collection and only mention the forms and controls collections, which are most commonly used by professional programmers.

The candidate should be able to explain the following points:

  • The forms collection contains the collection of loaded forms in a project. Not all forms in the project are included in the forms collection. A common task is to loop through the collection of forms when an application is terminating and unload each of the forms. The forms collection has a single property, Count, that specifies the number of elements in the collection.

  • The controls collection contains the controls on an object (usually a form). The controls collection has a count property and an item method. The controls collection also has an Add method that allows you to add the control to the collection and a Remove method that allows the removal of a control from a collection. If a programmer knows collections, then that person will know how to add and remove from a collection.

  • The printers collection contains the available printers. This is less common and many times a programmer will forget about the printers collection, I would not rule a candidate out if he forgot about this.

Note: While it is possible to create an application without using collections, a Visual Basic programmer should have a basic understanding of collections in general and understand the forms and controls collections.

A collection loosely defined is a way of grouping of similar objects.


Here are some potential wrong answers and what they say about the candidate:

  • Anything related to ADO. ADO is not intrinsic (built in) it must be added. This indicates the user may be very green or is not familiar with the concept of collections.

  • Combobox, textbox, object, checkbox, timer or any other control. These are controls, not collections. This also indicates the user may be very green or is not familiar with the concept of collections.

  • Common dialog - again this is a control not a collection.

Bonus questions:

The following questions test the candidates understanding of collections in general.

On the following form:


What will be displayed in the messagebox in the following code?

MsgBox Form1.Controls.Count

The correct answer is "4'. There are 4 controls on the form, the label, the command button, the textbox and the checkbox. If the candidate gives any answer other than 4, it might mean the user is not familiar at all with the controls collection.

When looping through the controls collection, how can I tell the type of control I'm working with?

The TYPEOF and TYPENAME functions will allow you to test each control and determine its type.


About the author

Mark Horninger, A+, MCSE+I, MCSE, MCSD, MCDBA, is President and founder of Haverford Consultants Inc. (http://www.haverford-consultants.com), located in the suburbs of Philadelphia, PA. He develops custom applications and system engineering solutions, specializing primarily in Microsoft operating systems and Microsoft BackOffice products. He has over 12 years of computer consulting experience and has passed 31 Microsoft Certification Exams. During his career Mark has worked on many extensive and diverse projects including database development, client server and web-based application development, training, embedded systems development and Windows NT and 2000 project rollout planning and implementations. Mark is a contributing author to the books: MCSE Windows 2000 Professional Study Guide, Designing SQL Server 2000 Databases for .NET Enterprise Servers, VB .NET Developers Guide and Configuring and Troubleshooting Windows XP Professional.

Mark lives with his wife Debbie and three children in Havertown, Pa. and can be reached at mark@haverford-consultants.com or markh@op.net.


REVIEWNET is a trademark and service mark of ReviewNet Corporation © 1997-2002,
Jenkintown, PA - All Rights Reserved. This information is confidential and proprietary
to ReviewNet Corporation. Use, duplication or misappropriation is strictly prohibited.