arrays - Will not display in list box VB -


so, i'm trying display statistics soccer teams points scored. @ time being executed, arrays have been filled , not. when form opens, i'd display maximum, minimum, , average scores.... want players name , score max , min. example:

    maximum: john scored 9      minimum: joe scored 2 

like, i'd getting value @ strplayers(i) name , intscores(i) score. i'm pretty sure had functions correct, but, whatever reason, can not display in list box upon loading form!

public class frmdisplaystatistics  function findmaximum() string     dim max integer     dim integer = 0      redim intscores(intnumberofplayers)      max = cint(intscores(0))     = 0 intnumberofplayers         if max < intscores(i)             max = cint(intscores(i))         end if     next       max = strplayers(i) & " scored maximum points of " & intscores(i)       return max  end function  function findminimum() integer     dim min integer     dim integer = 0      redim intscores(intnumberofplayers)      min = cint(intscores(0))     = 0 intnumberofplayers          if min > intscores(i)             min = cint(intscores(i))           end if      next       return min  end function  function findaverage() double     dim average double     dim integer = 0       average = total / intnumberofplayers      return average  end function  private sub frmdisplaystatistics_load(byval sender system.object, byval e system.eventargs) handles mybase.load     dim max string     max = findmaximum()     lststatistics.items.add(max)     lststatistics.items.add("minimum: " & findminimum())     lststatistics.items.add("average: " & findaverage())    end sub  private sub btnok_click(byval sender system.object, byval e system.eventargs) handles btnok.click     me.close() end sub end class 

the reason maximum returns string , minimum , average return number because trying different approach, did not work. :/

assuming getting array in variable max in form load event. should loop array. below

for = 0 max.count -1      listbox.item.add(i)  next 

also need declare variable max array. hope got point


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -