Microsoft KB Archive/141897

= How to Add Columns to the DBGrid Control at Design Time =

Article ID: 141897

Article Last Modified on 12/9/2003

-

APPLIES TO


 * Microsoft Visual Basic 4.0 Standard Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 16-bit Enterprise Edition
 * Microsoft Visual Basic 4.0 32-Bit Enterprise Edition

-



This article was previously published under Q141897



SUMMARY
This article shows how to add columns to the DBGrid control at design time. Adding columns is accomplished by setting properties of the Column objects by using the right mouse button to click on the control.



MORE INFORMATION
Use of the right mouse button (right click) to click on the DBGrid control is not clearly documented in online help; however, it is discussed briefly in Chapter 24 of the Programmer's Guide in the Design-time Operations section and in more detail in Books Online.

Step-by-Step Example

 * 1) Start Visual Basic or on the File menu, click New Project (ALT, F, N) if Visual Basic is already running. Form1 is created by default.
 * 2) On the Tools menu, click Custom Controls, then check the DataBound grid control.
 * 3) Click OK; this adds the control icon to the toolbar.
 * 4) Add one DBGrid control to the form1.
 * 5) Right-click the control and click Edit on the menu.
 * 6) Right-click the control again and click Insert or Append.

Clicking Insert inserts a new column to the left of the selected column(s) or to the left of the column under the cursor.

Clicking Append adds a new column to the far right of the columns in the control.

The result is that one additional column is added.

