Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Form1
- Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
- Dim DescendingButton As New Button
- DescendingButton.Location = New System.Drawing.Point(196, 70)
- DescendingButton.Name = "DescendingButton"
- DescendingButton.Size = New System.Drawing.Size(75, 23)
- DescendingButton.TabIndex = 2
- DescendingButton.Text = "Descending"
- DescendingButton.UseVisualStyleBackColor = True
- AddHandler DescendingButton.Click, AddressOf DescendingButtonClicked
- Controls.Add(DescendingButton)
- End Sub
- Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
- End Sub
- Private Sub DescendingButtonClicked(ByVal sender As System.Object, ByVal e As System.EventArgs)
- TextBox1.Text.Split(",").Count()
- Dim temp As Integer
- Dim array(50) As Integer
- Dim count As Integer
- Dim numbers() As String
- Dim result As String
- numbers = TextBox1.Text.Split(",")
- count = numbers.Count
- For index As Integer = 0 To count - 1
- array(index) = Convert.ToInt32(numbers(index))
- Next
- For index As Integer = 0 To count - 1
- For index2 As Integer = 0 To count - 2 - index
- If array(index2) > array(index2 + 1) Then
- temp = array(index2)
- array(index2) = array(index2 + 1)
- array(index2 + 1) = temp
- End If
- Next
- Next
- For index As Integer = 0 To count - 1
- If index = count - 1 Then
- result += array(index).ToString()
- Else
- result += array(index).ToString() + ","
- End If
- Next
- Label1.Text = result
- End Sub
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- TextBox1.Text.Split(",").Count()
- Dim temp As Integer
- Dim array(50) As Integer
- Dim count As Integer
- Dim numbers() As String
- Dim result As String
- numbers = TextBox1.Text.Split(",")
- count = numbers.Count
- For index As Integer = 0 To count - 1
- array(index) = Convert.ToInt32(numbers(index))
- Next
- For index As Integer = 0 To count - 1
- For index2 As Integer = 0 To count - 2 - index
- If array(index2) > array(index2 + 1) Then
- temp = array(index2)
- array(index2) = array(index2 + 1)
- array(index2 + 1) = temp
- End If
- Next
- Next
- For index As Integer = 0 To count - 1
- If index = count - 1 Then
- result += array(index).ToString()
- Else
- result += array(index).ToString() + ","
- End If
- Next
- Label1.Text = result
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement