Public Class Form3
Dim numeros(4) As Integer
Dim c1, x As Integer
Public Function sumar(ByVal x() As Integer) As Integer
Dim i, j As Integer
For Each i In x
j += i
Next
sumar = j
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
For c1 = 0 To 4
numeros(c1) = InputBox("Ingrese un numero entero")
Next
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
MsgBox(sumar(numeros))
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Form4.Show()
End Sub
End Class

No hay comentarios:
Publicar un comentario