vb6で整数の配列から整数を見つける方法について、誰でもアイデアを持っていますか?
Dim myArray(2) As Integer
myArray(1) = 1001
myArray(2) = 1002
Dim searchTerm As Integer
searchTerm = 1005
Dim flag As Boolean
flag = True
Dim temp As Variant
For Each temp In myArray
If temp = searchTerm Then
flag = False
End If
Next temp
If flag = False Then
MsgBox "find"
End If
For Each ステートメントを使用して解決策を得ましたが、Do..Loop を使用して解決策が必要ですか??
編集
Dim myArray(2) As Integer
myArray(0) = 1000
myArray(1) = 1001
myArray(2) = 1002
'Initialise Search Term
Dim searchTerm As Integer
searchTerm = 1001
'Check if a value exists in the Array
If UBound(Filter(myArray, searchTerm)) >= 0 And searchTerm <> "" Then
MsgBox ("Search Term SUCCESSFULLY located in the Array")
Else
MsgBox ("Search Term could NOT be located in the Array")
End If