Public Class Form1
Dim a(5) As Integer
Private Sub readarraybtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
readarray()
End Sub
Private Sub readarray()
For i As Integer = 0 To a.length - 1
a(i) = CInt(inputbox(""))
ListBox1.items.add(a(i))
Next i
End Sub
Function search(ByRef a() As Integer, ByRef s As Integer) As String
Dim found As Boolean
For i As Integer = 0 To a.Length - 1
If a(i) = s Then
found = True
search = " found in index no : " + i.ToString
End If
Next i
If found = False Then
search = " not found"
End If
Return search
End Function
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Dim j As Integer = CInt(InputBox(""))
Label5.Text = j.ToString +search(a, j)
' search(a, j)
End Sub
End Class