Public Class Form1 'Private rain() As Integer = {7, 8, 0, 4, 3, 8, 1} Private rain(6) As Integer Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load rain(0) = 7 rain(1) = 8 rain(2) = 0 rain(3) = 4 rain(4) = 3 rain(5) = 8 rain(6) = 1 Display() End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim index, value As Integer index = CInt(TextBox1.Text) value = CInt(TextBox2.Text) rain(index) = value Display() End Sub Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged End Sub Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged End Sub Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged End Sub Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click End Sub Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click End Sub Private Sub Display() Dim dn As Integer TextBox3.Text = Nothing For dn = 0 To 6 TextBox3.Text = TextBox3.Text & "day " & CStr(dn) & " rain " & CStr(rain(dn)) & vbCrLf Next largest() End Sub Private Sub largest() Dim max As Integer = 0 Dim maxind As Integer = 0 Dim i As Integer For i = 0 To 6 If rain(i) > max Then max = rain(i) maxind = i End If Next Label2.Text = "largest value is " & CStr(max) & " at " & CStr(maxind) End Sub Private Sub Label1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click End Sub Private Sub Sort(ByVal array() As Integer) Dim i, j As Integer For j = 1 To UBound(array) For i = 0 To UBound(array) - j If (array(i) > array(i + 1)) Then Swap(array(i), array(i + 1)) End If Next Next End Sub Private Sub Swap(ByRef a As Integer, ByRef b As Integer) Dim temp As Integer temp = a a = b b = temp End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Sort(rain) Display() End Sub End Class