How to add 1 to 1000 values in Visual Basic 2010..need help please!!?
-
I need to have 1000 values and then have them added at the end but i dont know the exact code for it. Im new to this program and im learning about them. I know i need to use some sort of a loop but i don't know which one exactly..can anyone help me please! I have the following code (this is just an example): Dim values () As Integer = {85, 77,....} Dim result As Integer For i = ø to values.Getupperboud(ø) result += values(i) Next lblresult.text = convert.tostring(result) but i have to use the same code only that it needs to have 1000 and have to display the final addition once i debug it...thanx again
-
Answer:
Try this code. It generates 1000 random numbers between 1 and 25, adds them together, places each number in a listbox, and finally shows the total of all 1000 numbers. It uses a button and a listbox. Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim Total, Num As Double For i = 1 To 1000 Randomize() 'Dim Rnd As New Random Num = Fix(Rnd() * 25 + 1) Total += Num ListBox2.Items.Add(Num) Next ListBox2.Items.Add(" ") ListBox2.Items.Add(" ") ListBox2.Items.Add(" ") ListBox2.Items.Add(Total) End Sub TexMav
Anonymou... at Yahoo! Answers Visit the source
Related Q & A:
- I did something really bad and now i need help please help me.Best solution by Yahoo! Answers
- How do you solve this chemistry problem? Need HELP?Best solution by Yahoo! Answers
- I need help with my camera, please.Best solution by Yahoo! Answers
- How do you use the Contains Function in Visual Basic?Best solution by go4expert.com
- How do I output from one form to another in Visual Basic?Best solution by support.microsoft.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.