reduce size of column in a datagrid

I have a data grid in vb6.  The columns have a default width when the records pull up.  I want to decrease the width of the columns in the datagrid, so that it looks like it will only hold one number.

How can I do this, if at all?
Who is Participating?
lppperesConnect With a Mentor Commented:
If you are using DataGrid, you can set the size of a column this way:
DataGrid1.Columns(0).Width = 100

If you are using MSFlexGrid, you can do this:
MSFlexGrid1.ColWidth(0) = 100
al4629740Author Commented:
If i do:

 DataGrid1.Columns(0).Width = 0
 DataGrid1.Columns(1).Width = 100

will they be two different lengths?
Yes. Each column will have a different size. In fact, if you set first column with value 0, it will be "invisible".
al4629740Author Commented:
When I do :

 DataGrid1.Columns(1).Width = 500
 DataGrid1.Columns(2).Width = 250
 DataGrid1.Columns(3).Width = 250
 DataGrid1.Columns(4).Width = 250
 DataGrid1.Columns(5).Width = 250
 DataGrid1.Columns(6).Width = 250

I get subscript out of range for the second line.  Why?
al4629740Author Commented:
never mind.  found the problem
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.