Results 1 to 6 of 6

Thread: [RESOLVED] Having Trouble about Array Sorting

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2013
    Location
    Turkey
    Posts
    12

    Resolved [RESOLVED] Having Trouble about Array Sorting



    My english is not well. So I add an image to explain my problem easy.

    I need to add numbers (in upper textbox) by inputbox**. But also when user click on SORT, numbers have to written in lower textbox.

    Can I assign global values to an array with inputbox ? How ?
    **Every click adds only one number.
    When i use

    Code:
    array.sort(Numberarray)
    
    for i=0 to elementnumber
    textbox2.text= cstr(numberarray(i))
    next
    it write 0 0 0 0

    edit: Now i understand my mistake. it wrote 0 0 0 0 because I created 999 elements array. But Now How can I create an array that have number of elements as the number of clicks.(i am not sure about that sentence )

    for example if user entered 4 numbers Array should have 4 elements. How can I Do that ??

    I resolve it myself. I'll explain it. maybe it would be useful for others.

    I created 999 elements array and I use Arra.sort(arrayname). Then I wrote a For-Next
    Code:
    for i=999-(elementnumber+1) to 999
    textbox1.text = textbox1.text + cstr(arrayname(i))
    next
    basicly When you sort the 999 elements array It will be something like (0,0,0,0...0,0,1,2,4,7,9) then the For-Next wrote the sorted array's last elements in to the textbox.
    Last edited by deccoyi; Dec 18th, 2013 at 05:34 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width