Logo 
Search:

VB.Net Answers

Ask Question   UnAnswered
Home » Forum » VB.Net       RSS Feeds
  Question Asked By: Priya Mohana   on Jan 03 In VB.Net Category.

  
Question Answered By: Shruti Sharma   on Jan 03

Hi Priya,

Create one vb.net web application and replace page load method with following


Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim MyArrList As ArrayList = New ArrayList()

'Initialize Array
MyArrList.Add(20)
MyArrList.Add(18)
MyArrList.Add(2)
MyArrList.Add(10)
MyArrList.Add(5)
MyArrList.Add(90)

'Sort elements in array to get smallest value
MyArrList.Sort()

'For displaying result
Dim sbResult As StringBuilder = New StringBuilder()
For I As Integer = 1 To 3 Step 1
If I = 3 Then
sbResult.Append(MyArrList(I - 1).ToString())
Else
sbResult.Append(MyArrList(I - 1).ToString() + ", ")
End If
Next

'Displaying result on browser
Response.Write("Smallest Three values are: " + sbResult.ToString())
End Sub

Share: