Autosize listbox columns

Jerome

Registered User.
Local time
Yesterday, 18:49
Joined
Jul 21, 2009
Messages
77
Hello,

I have a search form that searches a table and shows the records that meet the search criteria in a list box.

The problem is that the width of the list box columns can't be easy auto sized.

I know it is in fact possible but this is rather difficult:

http://www.access-programmers.co.uk/forums/showthread.php?t=91090&highlight=autosize+listbox+column

Is there another control that can be used to list search results? In visual basic .net there is for example the datagridview.

Thanks in advance.
 
It's not that complicated...
1) sum current column widths
2) get Scale which is ControlWidth / SumColumnWidths
3) set each existing NewColumnWidth to OldColumnWidth * Scale
 
Sorry I think I forgot to mention that I have 8 columns, and 6 of these column have a fixed column width but two columns should have a variable/autosize with, depending on the content.

This because the names that are inputted in this column can vary much in length, but I would like to be able to show the full name in the column.

Is it possible to search for the longest word in the column and adjust the width using this? Or is there another way to do this?

Thanks in advance.
 

Users who are viewing this thread

Back
Top Bottom