Searching data within the array
The easiest way to search is to check all the array elements from the smallest index to the largest index of searchable data to be found. Example use in an array of data search is shown in the following programs:
Dim data(5) As Integer
Dim x As Integer
Randomize
For i = 0 To 5
data(i) = Rnd() * 10 + 5
Next
x = InputBox("Entry Data: ", "Input")
For j = 0 To 5
If x = data(j) Then
cek = True
Exit For
Else
cek = False
End If
Next
If cek = True Then
MsgBox ("Found")
Else
MsgBox ("Not Found")
End If
Currently have 0 komentar: