Write a VB.NET program to Design following form to store numbers in single dimensional array and tofind Maximum number & Sum of all numbers in array.
Public Class Form1 Dim a(5), max, sum As Integer Dim i As Integer Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSum.Click Dim i As Integer For i = 0 To 4 sum = sum + a(i) Next txtSum.Text = sum End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMax.Click Dim i As Integer max = a(0) For i = 0 To 4 If a(i) > max Then max = a(i) End If txtMax.Text = max Next End Sub Private Sub btnNo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNo.Click Dim i As Integer For i = 0 To 4 a(i) = InputBox("Enter the 5 Number") If a(i) < 0 Then MsgBox("You are entered "a(i)&"(-venumber) so program will be quit") End End If Next End Sub Private Sub btnDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click Dim i As Integer For i = 0 To 4 lstNo.Items.Add(a(i)) Next End Sub Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click End End Sub Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click txtMax.Text = "" txtSum.Text = "" lstNo.Items.Clear() End Sub
Write a VB.NET program to Design following form to store numbers in single dimensional array and tofind Maximum number & Sum of all numbers in array.
Reviewed by
on
April 27, 2015
Rating: