473,412 Members | 2,284 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

expand a listbox to fit query?

Hi everyone,
is it possible to expand a listbox based on what is queried to it? The listboxes I have bring up records depending on whawt is queried, but because I have 20 listboxes doing this I would like to minimize the amount of space that they take. Sometimes the set size is too small and the the listbox will go into scroll mode (I need to print the results in the listboxes so scrolling listboxes don't work). Does anyone have any ideas?
Nov 3 '08 #1
3 7504
FishVal
2,653 Expert 2GB
Hello, StarryNight.

Though you may easily change ListBox height and position using Listbox.Height, Listbox.Left and Listbox.Top properties, I think there is no "native" way to fit ListBox height.

You may use an approach similar to that described in The Bytes Tip of the Week - How to Dynamically set the Combo Drop Down List Width to determine text height.

You may estimate an appropriate height increment per listbox row manually and use it as long as listbox font does not changes.

Regards,
Fish
Nov 3 '08 #2
thanks Fish,
considering my skill level, I'm going to have to think 'around' the problem. However, having your input is helping narrow my focus.
thanks.
Nov 3 '08 #3
missinglinq
3,532 Expert 2GB
Of course, what hasn't been said, but should be, is that you shouldn't be printing forms, you should be using reports to print . Having said that

Me.YourListBoxName.Height = YourListBoxName.ListCount * (0.15 * 1440)

will set the height correctly, assuming that you're using the default font Tahoma with the default size of 8. With other font/sizes you'd have to experiment with the

0.15

number. You'd also have to think about what happens if the wuery returns more items than your form has room to display.

Welcome to Bytes!

Linq ;0)>
Nov 4 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Harlin Seritt | last post by:
I am trying the following: Listbox(parent).pack(fill=BOTH, expand=YES) I notice that the listbox will fill on the X axis but will not on the Y axis unlike other widgets. Is there any way to...
1
by: Adam Endicott | last post by:
I'm having some trouble using an HtmlListBox with a GridBagSizer. I'm not sure how best to explain what's happening, but it seems that every time my frame gets resized, the HtmlListBox grows...
3
by: louise | last post by:
hi i am trying to set up a mail merge button which takes records from a multi-select listbox (the contents of which are decided by a query created by a search from) and not from a specific...
4
by: Giulio | last post by:
Hello, I have a continuous form with a combo box inside. From the combo box I can pick some values which, by the "after-update" event, change some other combo box values determined by a query....
2
by: Simon P | last post by:
Hello group, I'm in desperate need of help. Here goes : I have the following tables : CONTACTS (ContactID, FirstName, LastName, Company, etc.), SHOWS (ShowID, ShowDescription) and SHOWDETAILS...
2
by: Geir Baardsen | last post by:
Hi! From a listbox I'd like to send only selected items to a report. Items will include: OrderNr,Date,EmployeeNr from tblOrders ZipCode,City from tblZipCodes Name,Adr,ZipID from...
4
by: carl.barrett | last post by:
Hi, I have a list box that displays 2 columns. Behind it sits a query with five columns. These are Column1 (DOB), column2 (a concatenated string of Surname Forname, Title), Column3 (Surname),...
5
by: pnp | last post by:
to store other items that just strings? Thanks Peter
20
by: exipnakias | last post by:
Hello Guys. In a form I created a listbox which looks up the values of a table. I want: 1) ..to create a query where a parameter will be needed in order to be loaded. But I do not want to...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.