A simple program that I wrote in VB.NET and ASP.NET to check which of the array list value has the highest value.
I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details. If you want to advertise on my website kindly contact me also in my email address also. Thank you.
Program Listing
Public Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Public Function DetermineMax(ByVal itemList As ArrayList)
Dim max As Integer = Nothing
For i As Integer = 0 To (itemList.Count - 1)
If i = 0 Then
max = itemList(i)
Else
If itemList(i) > max Then max = itemList(i)
End If
Next
DetermineMax = max
End Function
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
Dim numList As New ArrayList
numList.Add(1)
numList.Add(523)
numList.Add(3)
numList.Add(155)
numList.Add(123)
numList.Add(15)
numList.Add(25)
numList.Add(1225)
numList.Add(5)
Label1.Text = "==== List of Numbers ===== "
For i As Integer = 0 To numList.Count - 1
Dim val As String = numList(i).ToString()
Label1.Text += "<br />" + val
Next
Label2.Text = "The highest number is " + DetermineMax(numList).ToString()
End Sub
End Class
No comments:
Post a Comment