I've got 3 labels above a multi col listbox.
Is there a formula to set their width from the list columnWidths property?
Once known I can maybe set their Left pos as well.
I've got 3 labels above a multi col listbox.
Is there a formula to set their width from the list columnWidths property?
Once known I can maybe set their Left pos as well.
You set the column widths in the listbox columnwidth property- so easy to work out. Just remember there are 1440 twips to an inch
From what I read you can't set a name for column headers , it has to be a bound control?
So 567 tw to CM then I found all I needed was
Me.Label2.Width = Split(Me.List0.ColumnWidths, ";")(0)
Me.Label3.Width = Split(Me.List0.ColumnWidths, ";")(1)
Me.Label4.Width = Split(Me.List0.ColumnWidths, ";")(2)
Me.Label3.Left = Me.Label2.Width + Me.Label2.Left
Me.Label4.Left = Me.Label3.Width + Me.Label3.Left
"can't set a name for column headers , it has to be a bound control" - don't understand this statement.
Listbox ColumnHeaders uses field names from RowSource. If you don't want to use the native field names, use alias in RowSource SQL.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
I'm sure you know June, that was something I read while looking for an answer with Google.
This hasn't a row source though, it's just a list showing some data and one row is selected/used after clicked.
An UNBOUND listbox certainly can have column headers - whether RowSourceType is Table/Query or Value List.
How are you building this list?
But why do you need dynamic code to set label positions anyway? Is this listbox content variable?
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
It is a value list and I'm filling it with additem. The 3 columns hold filename, bitrate and duration. These are calculated in a class module the file is sent into.
I initially set the coordinates manually, changing the values until they were right. Then thought that is crazy, any changes to the column widths and all that had to be done again.
Let the computer do it... and it has worked out perfectly. I suspect you may be saying none of that was neccesary but it achieved the goal. If you want to show an alternate (proper?) way, I'm all ears.
I am not saying it is proper, just possible. Some like to use listbox headers - I have used but only with listboxes used to display data, not for data selection.
With ColumnHeaders set to Yes, first line of list will be treated as headers. Keep in mind that when activated, headers occupy row index 0.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Thanks June , that worked just as you described. Much more eloquent. I would have looked for that except for finding into to the contrary. Never believe what you read ? !!
I could not see ColumnHeaders, only ColumnHeads and it worked ok irrespective of the setting there.
Sorry, my typing error. But you found it anyway.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.