Solved

reduce size of column in a datagrid

Posted on 2009-07-09
5
241 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
never mind.  found the problem
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

744 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now