Public Class Form4
    Dim a(3, 5) As Integer     '声明数组a，为该模块所有过程所有
    '按钮“产生数组”的Click事件代码如下：
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim p As String = "", i As Integer, j As Integer
        Randomize()
        For i = 0 To 3
            For j = 0 To 5
                a(i, j) = Int(Rnd() * 81) + 15
                p = p & a(i, j) & "  "
            Next j
            p = p & vbCrLf
        Next i
        TextBox1.Text = p
    End Sub
    '求各行最大元素之和命令按钮的Click事件代码完成:
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim i As Integer, j As Integer
        Dim MaxRow As Integer, SumRow As Integer
        For i = 0 To 3
            MaxRow = a(i, 0)
            For j = 1 To 5
                If a(i, j) > MaxRow Then MaxRow = a(i, j)
            Next j
            SumRow = SumRow + MaxRow
        Next i
        TextBox2.Text = SumRow
    End Sub
End Class