Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27214

[help]sorting textboxes.text with numbers

$
0
0
Hi i want to sort 4 textboxes with numbers(user give the numbers).I search and find the bubblesort method but it dont work with textboxes.i tested with numbesr and worked fine. What am i doing wrong? plz help


This is my code:
Code:


 Dim labe() As Label = New Label() {Label1, Label2, Label3, Label4}
Dim J As Integer = 0
Dim Temp As Integer = 0
Dim swapped As Boolean
Dim selements As Integer = 4
Dim spot As Integer() = {TextBox1.Text, TextBox2.Text, TextBox3.Text, TextBox4.Text}
Dim i As Integer = 0


 Do
            swapped = False

            For J = 0 To (selements - 1)

                If spot(J) < spot(J + 1) Then
                    Temp = spot(J)
                    spot(J) = spot(J + 1)
                    spot(J + 1) = Temp

                    swapped = True
                End If
            Next
            selements = selements - 1
        Loop Until swapped = False

Do Until i = 4

            labe(i).Text = spot(i)

            i = i + 1

        Loop


Viewing all articles
Browse latest Browse all 27214

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>