vb.net - Getting upperbound and lowerbound from a textbox -


i'm trying figure out code project don't understand it. objective write program generates set of 10 random numbers , stores in array (the 10 numbers display in textbox correctly). should have button compute minimum, maximum , average of array. cant seem max , min values of textbox. know people don't post answers , i'm not looking if tell why i'm doing max/min wrong or point in right direction appreciate it. thank you!

private sub button1_click(sender object, e eventargs) handles button1.click       dim randomarray new random()     dim randomnumber integer      = 1 10         randomnumber = randomarray.next(1, 101)         displaynumberstextbox1.appendtext(randomnumber & " ")         displaynumberstextbox1.text = convert.tostring(randomnumber)     next end sub  private sub button2_click(sender object, e eventargs) handles button2.click     dim randomarray new random()     dim randomnumber integer      = 1 10         randomnumber = randomarray.next(1, 101)         displaynumberstextbox1.appendtext(randomnumber & " ")     next      dim min integer     min = displaynumberstextbox1.text.getlowerbound()     displaymintextbox2.text = min end sub 

for starters, see code in button1:

textbox1.appendtext(randomnumber & " ") textbox1.text = convert.tostring(randomnumber) 

the 2nd line negates first. remove it. instead, clear textbox @ beginning of button click handler.

next, in button 2 code goes through , re-creates new set of random numbers, instead of using set created first button. more, @ no point numbers ever stored in array. need array declared outside of either button, in in code button1 set elements of array, can use numbers again in button2 more easily.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -