Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

list box

Posted on 1999-08-02
7
Medium Priority
?
154 Views
Last Modified: 2010-04-30
How can I know how many lines a list box has?
0
Comment
Question by:alexbeaty
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 22

Accepted Solution

by:
ture earned 120 total points
ID: 1529089
alexbeaty,

This shows the number of lines in the list in listbox List1.

  MsgBox List1.ListCount

Ture Magnusson
Karlstad, Sweden
0
 
LVL 10

Expert Comment

by:smegghead
ID: 1529090
Or do you mean how many list items can you fit in the displayable area of your listbox ???
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 1529091
Dim SomeVariable As ListBox

Now, move the cursor over the word ListBox, and highlight the whole word.

Hit F1

This works for any VB control.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 10

Expert Comment

by:caraf_g
ID: 1529092
Dim SomeVariable As ListBox

Now, move the cursor over the word ListBox, and highlight the whole word.

Hit F1

This works for any VB control.
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 1529093
My apologies, I hit enter and the submit button must have had focus? Odd...
0
 

Author Comment

by:alexbeaty
ID: 1529094
But how can I retrieve in a list box the name of the 1st item or the 2nd or the 15th ...?
0
 
LVL 10

Expert Comment

by:smegghead
ID: 1529095
I think caraf_g's point it... press F1 to obtain help - you'll find most things there..

 List1.AddItem "smeggy" ' will be item 0
 List1.AddItem "was" ' and this will be item 1
 List1.AddItem "here" ' and this 2
 MsgBox List1.ListCount ' returns the count of list items
 MsgBox List1.List(1) ' returns "was"
 MsgBox List1.List(2) ' returns "here"

hth

Smeggs
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

721 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