Public Class Form1
Private Sub BtnDisplayElements_Click(ByVal sender As [Link], ByVal e
As [Link]) Handles [Link]
[Link]()
'Declare and populate an array
Dim strMyFriends(4) As String
strMyFriends(0) = "Elaine"
strMyFriends(1) = "Richard"
strMyFriends(2) = "Debra"
strMyFriends(3) = "Wendy"
strMyFriends(4) = "Ben"
'Displaying elements from the array
For Each strName As String In strMyFriends
[Link](strName)
Next
End Sub
Private Sub BtnSortAscending_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link]()
'Declare and populate an array
Dim strMyFriends(4) As String
strMyFriends(0) = "Elaine"
strMyFriends(1) = "Richard"
strMyFriends(2) = "Debra"
strMyFriends(3) = "Wendy"
strMyFriends(4) = "Ben"
[Link](strMyFriends)
'Displaying elements in array
For Each strName As String In strMyFriends
[Link](strName)
Next
End Sub
Private Sub BtnSortDescending_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link]()
'Declare and populate an array
Dim strMyFriends(4) As String
strMyFriends(0) = "Elaine"
strMyFriends(1) = "Richard"
strMyFriends(2) = "Debra"
strMyFriends(3) = "Wendy"
strMyFriends(4) = "Ben"
'Sorting the array first and then reverse the order for descending
'Remove the sort and test, Notice the element positions will be reversed
[Link](strMyFriends)
[Link](strMyFriends)
'Displaying elements in array
For Each strName As String In strMyFriends
[Link](strName)
Next
End Sub
Private Sub btnReverseArray_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link]()
Dim strMyFriends(4) As String
strMyFriends(0) = "Elaine"
strMyFriends(1) = "Richard"
strMyFriends(2) = "Debra"
strMyFriends(3) = "Wendy"
strMyFriends(4) = "Ben"
'Notice the element positions will be reversed
[Link](strMyFriends)
'Displaying elements in array
For Each strName As String In strMyFriends
[Link](strName)
Next
End Sub
Private Sub BtnNumbers_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
Dim numbers(4) As Integer
numbers(0) = 0
numbers(1) = 1
numbers(2) = 20
numbers(3) = 30
numbers(4) = 15
[Link](numbers)
For Each number As Integer In numbers
[Link](number)
Next
'Notice the reverse will display elements in reverse order
End Sub
Private Sub btnArraySize_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
Dim Colours(3) As String
'Declare a variable to hold the length of the array
Dim intArraySize As Integer
Colours(0) = "Yellow"
Colours(1) = "Red"
Colours(2) = "Blue"
Colours(3) = "Green"
'Get the array size
intArraySize = [Link]
'Display the array size
[Link]("The array size is: " & intArraySize)
End Sub
Private Sub btnSearching_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
Dim strColors = {"Red", "Green", "Blue", "Ren"}
'Finding a string
'Startswith makes use of a function that will check for a string
'The String will be case sensitive
Dim value1 As String = [Link](strColors, Function(x)
([Link]("Ren")))
[Link](value1)
End Sub
End class