Solved

reduce size of column in a datagrid

Posted on 2009-07-09
5
244 Views
Last Modified: 2012-05-07
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?
0
Comment
Question by:al4629740
  • 3
  • 2
5 Comments
 
LVL 2

Accepted Solution

by:
lppperes earned 500 total points
ID: 24820406
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
0
 

Author Comment

by:al4629740
ID: 24820477
If i do:

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

will they be two different lengths?
0
 
LVL 2

Expert Comment

by:lppperes
ID: 24820509
Yes. Each column will have a different size. In fact, if you set first column with value 0, it will be "invisible".
0
 

Author Comment

by:al4629740
ID: 24820512
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?
0
 

Author Comment

by:al4629740
ID: 24820519
never mind.  found the problem
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question