我正在尝试提出一个功能,该功能将允许用户分别按下按钮 BACK 和 NEXT 更改数据。
我正在使用此代码:
CounterID = IdArray.Length 'array of IDs
determinator = CounterID 'determining which index is active and putting it on the top of array
If Ident = 1 Then ' if button back is pressed
determinator = determinator + 1
If determinator <= CounterID Then
'some actions
End If
Else
determinator = determinator - 1
If determinator >= 0 Then
'some actions
End If
End If
它确实有效。但部分。我的问题是,每当按下按钮时,DETERMINATOR 变量的值就会再次分配给最大长度。
有什么办法可以避免重新分配这个变量并让它只发生一次?