Results 1 to 12 of 12

Thread: Sort a listbox

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2010
    Location
    Greece
    Posts
    58

    Sort a listbox

    Hello guys!
    I have a problem to sort the results in a listbox.
    Here is an example of what I mean


    Code:
    dim l as integer 
    dim m as integer 
    dim x as integer 'input value for loop
    dim y as integer 'input value for loop
    dim z as double
    
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    
    For Me.L = 1 To x ' user gives the x
    For Me.M = 1 To y ' user gives the y
    z = l*M
    ListBox1.Items.Add("(" & L & "," & M & ")= " & z)
    Next M
    Next L
    
    Exit Sub
    I am trying to find a way to sort the results in columns in this way:
    When the first 'L' loop ends then go to next column of the listbox.
    Let's say the user gives x=5 and y=8. I would like to have a listbox
    like this one in the attachment.
    I have tried the listbox proporties ''Horizontal Scrollbar''
    and ''MultiColumn'' but it didn't help... The sorting depends
    on ListBox Height-Width. Any ideas?
    Attached Images Attached Images  

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