I want to arrange numbers from highes to lowest ( you will input the numbers first e.g 1,2,3,4,5 ) and it will be 5,4,3,2,1
Thanks!
I want to arrange numbers from highes to lowest ( you will input the numbers first e.g 1,2,3,4,5 ) and it will be 5,4,3,2,1
Thanks!
Sounds like homework. What have you got so far?
"Visual Basic 2010"
I do have a similar problem,
I want to display on a listview a "top 10" highest to lowest data using MySQL as database,
my problem is, I dont know the codes for displaying data sorted from highest to lowest.
Anyone?
Please help me.
I am not a super genius type programmer... and sorry for my bad grammar ...
Use the ORDER BY clause with DESC when you do the SELECT.
To short numbers in descending order, you can use the following codes, if you like.
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim x(9) As Integer
For i As Integer = 0 To x.GetUpperBound(0)
x(i) = i + 1
Next
Dim y As Integer = 0
For k As Integer = 0 To (x.GetUpperBound(0) - 1)
For l As Integer = 0 To (x.GetUpperBound(0) - 1)
If x(l) < x(l + 1) Then
y = x(l)
x(l) = x(l + 1)
x(l + 1) = y
End If
Next
Next
For i As Integer = 0 To x.GetUpperBound(0)
ListBox1.Items.Add(x(i))
Next
End Sub
Jim is true. You can use Order By clause with DESC in your Select statement.
Further more, if you do not use this, you can try the above codes, if you like.
For that you can first pick up the numbers from your data table in an array.
thanks to everyone .. yup .. i made it .. sorry for the late response, I owe you all guys a big thanks ^^, .. Thank you !!!