| | |
Adding numbers from a user in an array
![]() |
•
•
Join Date: Nov 2009
Posts: 1
Reputation:
Solved Threads: 0
Private Sub AddToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddToolStripMenuItem.Click
Dim numbers() As Integer = {myarray(x)}
Dim element As Integer
Dim total As Integer
For Each element In numbers
total = total + element
Next element
End Sub
This is the code I have for adding the numbers in an array, but I keep getting an error that pertains to the top line that says "Handles clause requires a WithEvents variable defined in the containing type or one of it's base types". The words "AddToolStripMenuItem" are underlined. How can I fix this?
This is an assignment for school and I really need help!
Dim numbers() As Integer = {myarray(x)}
Dim element As Integer
Dim total As Integer
For Each element In numbers
total = total + element
Next element
End Sub
This is the code I have for adding the numbers in an array, but I keep getting an error that pertains to the top line that says "Handles clause requires a WithEvents variable defined in the containing type or one of it's base types". The words "AddToolStripMenuItem" are underlined. How can I fix this?
This is an assignment for school and I really need help!
•
•
Join Date: Jan 2008
Posts: 258
Reputation:
Solved Threads: 40
0
#2 Nov 19th, 2009
Your sub (code in that sub) is looking for an object -
When you declare an object, you have to show it. In this event you are coding under click event, refering to an object, probably a menu? (AddToolStripMenuItem)
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
ByVal sender As System.Object
When you declare an object, you have to show it. In this event you are coding under click event, refering to an object, probably a menu? (AddToolStripMenuItem)
Please mark questions as answered when done.
Be the ONE!!!
Be the ONE!!!
![]() |
Similar Threads
- How to save rand() numbers inside of array (C++)
- numbers from file to array (C)
- random numbers, and 2 dimensional array (C++)
- user given array size (C++)
- Adding numbers (Python)
- C Program for Adding two numbers without using + sign (C)
- error while adding two numbers (C#)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Help on changing label text
- Next Thread: retrieving a record...how...
Views: 530 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
* 6 7 429 access activex add ado append application basic beginner blackjack box calculator channel9 click client code college column component connection convert copy creative data database delete designer dissertationtopic edit error excel file filename filter flex form game hardware icon ide image implements inboxinvb installation interaction key label listbox listview liveperson looping macro messagebox metadata nice number open oracle os outlook picture pos prime print problem programmer prompt query random range range-objects readfile reading registration remotesqlserverdatabase report save search sites spectateswamp sql sqlserver string struct sum table timer variable vb vb6 vb6.0 vba visual visualbasic web window windows





