Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Programmatically Setting Column Names and Width on DBGrid

Status
Not open for further replies.

DTRNTR

MIS
Jun 27, 2000
34
0
0
US
Hello,

Can anyone tell me how to programmatically set Column Names and Width on DBGrid?

Thank You.....
 
Width:
DBGrid.Columns(0).Width = 100
DBGrid.Columns(1).Width = 200
.....
(I think).

I do not think you can set the names of the columns, although I have never tried. You might want to try:

DBGrid.Columns(0).Name = "Column_Name"

Although I am not sure if this will work.


Simon
 
This is how i do it DTRNTR:

.caption is the column name on the DBGrid (DBGrid_Display)

With DBGrid_Display
.Columns(0).Caption = "Your Column Name"
.Columns(0).Width = 2000
.Columns(0).Visible = False
End With

Chris (Tallman64)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top