Private a(1 To 500) As Integer
Private Declare Function MessageBox Lib "user32" Alias "MessageBoxA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long
Private Function search(number As Integer) As Integer
Dim j As Integer
For j = 1 To 500
If a(j) = number Then
MessageBox Form1.hwnd, "Нашёл!!!", "Ура!!!", 0
search = j
Exit For
End If
Next j
End Function
Private Sub Form_Load()
Dim i As Integer
Dim res As Integer
Randomize
For i = 1 To 500
a(i) = Rnd * 500
Next i
res = search(25)
End Sub
Private Declare Sub Sleep Lib "kernel32" (ByVal milliseconds As Long)
Private Function SearchControl(nControl, ArrayControls) As Long
Dim i As Long, IB As Long, IC As Long
IC = ArrayControls.Ubound
IB = ArrayControls.lbound
For i = IB To IC
If nControl.Index = ArrayControls(i).Index Then
Sleep 1: SearchControl = i: Exit Function
End If
Next
SearchControl = -1
End Function
Private Sub Command1_Click(Index As Integer)
MsgBox SearchControl(Command1(Index), Command1)
End Sub
Private Declare Sub Sleep Lib "kernel32" (ByVal milliseconds As Long)
Private Sub Command1_Click(Index As Integer)
Sleep 1
MsgBox Index
End Sub
Naked писал(а):Если не знаете ответа на этот вопрос, то избавьте от своих насмешек.
Звезд вроде много а помощи никакой...
Сейчас этот форум просматривают: Yandex-бот и гости: 66