Thread: Array
View Single Post
Old Apr 24th, 2008, 1:40 AM   #4
Freaky Chris
Hobbyist Programmer
 
Freaky Chris's Avatar
 
Join Date: Dec 2007
Location: England
Posts: 169
Rep Power: 1 Freaky Chris is on a distinguished road
Send a message via MSN to Freaky Chris
Re: Array

The reason why you are getting a 0 and that is it, is because the only item you are adding to ur list box after the first line is the value of salary.

VB.NET Syntax (Toggle Plain Text)
  1. ListBox1.Items.Add(salary.ToString)

if you are looking to print out the value in wach of the survey items from 0-8 then you would need to do something like this, after you case statement. All the case statement is doing is checking the value of salary and then increment the correct item with the array survey. Not adding them to the list box.

Something like this would add all of the items from survey into the listbox.

VB.NET Syntax (Toggle Plain Text)
  1. For i = 0 To 8
  2. ListBox1.Items.Add(survey(i).ToString)
  3. Next i


Cheers,
Chris
__________________
Who said i couldn't program
sarcasm = raw_input('Type in a sarcastic remark: ')
print sarcasm
Freaky Chris is offline   Reply With Quote