devxlogo

Tip Bank

Add Incremental Search to a Combo Box

As the user types into a drop-down combo box, he or she passes keystrokes to the ComboIncrementalSearch routine, which then searches the combo box

Force the Short-Circuit

To optimize the If construct, separating testing conditions (“And” operator or “Or” operator) in different expressions can improve the performance. For example, don

Customize the IDE Toolbar

The VB Integrated Development Environment (IDE) contains many toolbars and menu functions, and the functions you normally use are usually on different toolbars and menus, so most programmers have several

Reading Binary Data from an ifstream

To read a binary value from an input file stream (ifstream) object, use the read() member function. read() takes two parameters: char * and long, which hold the address of

Parenthesize Macro Arguments

It’s a good idea to parenthesize every macro argument. For example: #define MAX(x,y) (x)>(y)?(x):(y) The parentheses ensure that the macro is evaluated correctly, even if the user passes complex expressions

Serializing a Polymorphic Object

A polymorphic object has one or more virtual functions. When you serialize such an object to a file so that it can be reconstituted later, the deserialization might rewrite its