Click here to Skip to main content
15,884,177 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Process Naming Pin
Dave Kreskowiak10-Apr-08 12:32
mveDave Kreskowiak10-Apr-08 12:32 
GeneralRe: Process Naming Pin
Maffyx10-Apr-08 12:51
Maffyx10-Apr-08 12:51 
GeneralRe: Process Naming Pin
Dave Kreskowiak10-Apr-08 13:36
mveDave Kreskowiak10-Apr-08 13:36 
GeneralRe: Process Naming Pin
Maffyx10-Apr-08 13:51
Maffyx10-Apr-08 13:51 
GeneralRe: Process Naming Pin
Dave Kreskowiak10-Apr-08 16:04
mveDave Kreskowiak10-Apr-08 16:04 
GeneralRe: Process Naming Pin
Maffyx10-Apr-08 16:32
Maffyx10-Apr-08 16:32 
GeneralRe: Process Naming Pin
Dave Kreskowiak11-Apr-08 1:23
mveDave Kreskowiak11-Apr-08 1:23 
QuestionNEWBIE PROGRAMMER LEARNING QUESTION ON LISTBOX AND ADDING CONTENT TO DISPLAY IN LABEL Pin
Alex2192678-Apr-08 17:31
Alex2192678-Apr-08 17:31 
I am a noobie in programming in VB and I would really appreciate anyones help on a windows form I have to create.
In this application I should be able to enter an infinate amount of numbers into the OPERANDS LISTBOX, when the list box containts at least two numbers, the event handler should then enable the addition and multiplication Buttons. (I GOT THAT NO PROBLEM)

Then I have to define the ADD BUTTON. This event handler should compute the sum of all the values in the OPERANDS LISTBOX and display the result in the resultLabel.

Also need to define the Multiplication BUTTON. I need to compute the product of all the values in the Operands LISBOX and display the result in the resultLabel.

It is either the ADD or Multiplication BUtton, NOT BOTH.

Here is the CODE for the addition handler:

Private Sub addButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addButton.Click
Dim total As Integer = 0
Dim operandCounter As Integer = 0
Dim sum As Integer = 0
Dim addition As Integer = 0

' sum grades in ListBox
Do
sum = operandsListBox.Items.Item(operandCounter)
total += sum 'add sum to total
operandCounter += 1
Loop Until operandCounter >=2

WHen I fill in the list box with more then 2 numbers, it only add the first two numbers. I know I am aware that it is because I have only stated until >=2, but what code should I use if there is no limit to the number of times that a user can input numbers into the listbox???

So far I have only been able to get 2 items in the listbox to compute correctly and display on the listbox using the loop functions until and while, but I have been trying for hours to get this working when I have more then 2 items on the listbox, I know I can just increase the number, but I need to be able to grab all items in the list box and ADD (ADDBUTTON) or MULTIPLY (Multiply BUTTON) and display either one on the resultLabel.

PLEASE SOME ONE TAKE THE PAIN AWAY!

THANKS!

ALex
GeneralRe: NEWBIE PROGRAMMER LEARNING QUESTION ON LISTBOX AND ADDING CONTENT TO DISPLAY IN LABEL Pin
Christian Graus8-Apr-08 18:54
protectorChristian Graus8-Apr-08 18:54 
GeneralRe: NEWBIE PROGRAMMER LEARNING QUESTION ON LISTBOX AND ADDING CONTENT TO DISPLAY IN LABEL Pin
Alex2192678-Apr-08 19:36
Alex2192678-Apr-08 19:36 
GeneralRe: NEWBIE PROGRAMMER LEARNING QUESTION ON LISTBOX AND ADDING CONTENT TO DISPLAY IN LABEL Pin
Christian Graus8-Apr-08 19:42
protectorChristian Graus8-Apr-08 19:42 
GeneralRe: NEWBIE PROGRAMMER LEARNING QUESTION ON LISTBOX AND ADDING CONTENT TO DISPLAY IN LABEL Pin
Alex2192678-Apr-08 19:55
Alex2192678-Apr-08 19:55 
GeneralRe: NEWBIE PROGRAMMER LEARNING QUESTION ON LISTBOX AND ADDING CONTENT TO DISPLAY IN LABEL Pin
Christian Graus8-Apr-08 20:09
protectorChristian Graus8-Apr-08 20:09 
GeneralRe: NEWBIE PROGRAMMER LEARNING QUESTION ON LISTBOX AND ADDING CONTENT TO DISPLAY IN LABEL Pin
Alex2192679-Apr-08 3:19
Alex2192679-Apr-08 3:19 
GeneralRe: NEWBIE PROGRAMMER LEARNING QUESTION ON LISTBOX AND ADDING CONTENT TO DISPLAY IN LABEL Pin
Alex2192679-Apr-08 16:33
Alex2192679-Apr-08 16:33 
GeneralRe: NEWBIE PROGRAMMER LEARNING QUESTION ON LISTBOX AND ADDING CONTENT TO DISPLAY IN LABEL Pin
Alex21926710-Apr-08 17:21
Alex21926710-Apr-08 17:21 
GeneralRe: NEWBIE PROGRAMMER LEARNING QUESTION ON LISTBOX AND ADDING CONTENT TO DISPLAY IN LABEL Pin
Alex21926710-Apr-08 17:22
Alex21926710-Apr-08 17:22 
QuestionInstalling vb.net application Pin
KrisnNala8-Apr-08 8:27
KrisnNala8-Apr-08 8:27 
GeneralRe: Installing vb.net application Pin
Christian Graus8-Apr-08 11:21
protectorChristian Graus8-Apr-08 11:21 
GeneralRe: Installing vb.net application Pin
KrisnNala8-Apr-08 20:59
KrisnNala8-Apr-08 20:59 
GeneralFilename Pin
Zaegra8-Apr-08 7:15
Zaegra8-Apr-08 7:15 
GeneralRe: Filename Pin
Luc Pattyn8-Apr-08 7:19
sitebuilderLuc Pattyn8-Apr-08 7:19 
GeneralRe: Filename Pin
Zaegra8-Apr-08 7:24
Zaegra8-Apr-08 7:24 
GeneralAdding/Removing values from webbrowser control context menu Pin
Ahmad Zaidi8-Apr-08 4:55
Ahmad Zaidi8-Apr-08 4:55 
GeneralRe: Adding/Removing values from webbrowser control context menu Pin
Dave Kreskowiak8-Apr-08 7:14
mveDave Kreskowiak8-Apr-08 7:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.