answersLogoWhite

0


Best Answer

Don't use a list box for this. The purpose of a list box is to present a list of items from which a user can make a selection. That's clearly not what you are trying to do. Use an array instead (you can always construct a list box from an array if required):

Dim values As Integer() = {5, 3, 6, 4, 2}

Dim product As Integer = values(0)

For index = 1 To values.GetUpperBound(0)

product = product * values(index)

Next

Debug.WriteLine(product)

' output

' 720

Note that the for loop starts at index 1 rather than index 0. This is because the value at index 0 is already stored in the product variable and you want to multiply that value by the indexed value to create a new product. Thus on each iteration of the loop, the product accumulates.

User Avatar

Wiki User

9y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you find the product of all the items in a list box using visual basic?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is a visual basic code?

Visual Basic code is a program or library that has been written using the Microsoft Visual Basic programming language.


How do you make a scrollbar and a listbox work together using Visual Basic?

In visual basic if the number of items in your listbox is shorter than the height of your listbox then no scrollbar is displayed. If the number of items in you listbox is longer than the height then you get a scroll bar. This is for vertical scrolling. I have not encountered it with horizontal scrolling.


Thesis topic using visual basic programming language?

visual basic thesis topics


How do you visual basic?

I think you mean how do you work visual basic. Anyways, it is a programming language developed by Microsoft using a type of basic language. I would go to a site that will teach you vb (visual basic)


How do you publish you visual basic 2008 programs on the internet?

how can i summit a solution project using visual basic 2008 through the internet


How do you basic?

I think you mean how do you work visual basic. Anyways, it is a programming language developed by Microsoft using a type of basic language. I would go to a site that will teach you vb (visual basic)


How can you build a program using visual basic?

Download Visual Basic, Then Go Watch Tutorials on youtube or something, you'll learn over time, at least I did,


What has the author Elisabeth Boonin written?

Elisabeth Boonin has written: 'Using Excel Visual Basic for applications' -- subject(s): BASIC (Computer program language), Microsoft Visual Basic for applications


Mini project in newspaper management using visual basic language?

yes


Project in college admission system using visual basic 6.0?

yes


Why vb is called vb?

VB stands for Visual Basic. It is named as such because it is a programming language developed by Microsoft with a focus on providing a visual environment for the development of Windows applications.


Is visual basic a GUI operating system?

Visual basic is not a GUI operating system. In fact it is not even an OS. It is just a platform to develop GUI software for windows using BASIC-like programming syntax.