|
-
Aug 11th, 2000, 11:12 AM
#1
Thread Starter
New Member
When I load an Access database into a flexgrid...how can I get Visual Basic to pull up the format for each individual column width?
I'm sure Access uses a certain code to tell how much should each width be for each column.
If the above is not possible for Visual Basic...then maybe this is possible:
Go through each column and get the length of each cell...The one with the greatest length is set as an array(1-number of columns) Then format each column using a for/next statement.
The only problem and question for me is what is the right code to be able to do this?
I guess what would be good sample practice is a 2 column access file with two different lengths! And a visual-basic program that would load it into a flexgrid....but what is the code to format the width of each column? Any help on these two methods would be appreciated!!!
Kind regards,
Stephen
-
Aug 11th, 2000, 11:40 AM
#2
Junior Member
column width
To set the columnwidth to accomodate the largest entry in a given column you can use the columnwidth property of the grid after setting which column you will be using. The columnwidth is not set by number of spaces. I believe it is set by twips. To set the width to accomodate the longest entry you would need to search for the longest entry in that column :
with flexgrid
.row=0
OldWidth= Length$(FieldContents)
For x = 1 to .rows-1
NewWidth = Length$(FieldContents)
If NewWidth > OldWidth Then NewWidth = OldWidth
Next x
After finding the longest convert that length to twips (537 per cm, I think), then set the .ColumnWidth to the new value.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|