Im方案是视力基础的一个基本位置机器,希望利用机体随机选择每个位置的图像,显示每个位置的图像,并改变每个位置的梯度变量(因此,我可以随后检查点中的符号)。
The problem I m finding with a for loop is that the variables and objects for each slot have different names (slot1Name, slot2Name, slot3Name, lblSlot1, lblSlot2, lblSlot3, etc). Is there any way I could have something like:
currentSlotName = "slot" & i & "Name"
目前,这部法典在3个位置中的每一个位置都重复使用(有不同的变数和物体名称),而后者则效率极低。 我怎么能够放弃这一法典?
Randomise numbers and assign images to slots based on random numbers, if the hold isn t on
Slot 1
If Not held1 Then
slot1Value = Int(Rnd() * numbersGenerated + 0.5)
Select Case slot1Value
Case 0 To 5
lblSlot1.Image = imgBanana
slot1Name = "Banana"
Case 6 To 11
lblSlot1.Image = imgOrange
slot1Name = "Orange"
Case 12 To 16
lblSlot1.Image = imgCherries
slot1Name = "Cherries"
Case 17 To 19
lblSlot1.Image = imgSeven
slot1Name = "Seven"
Case 20
lblSlot1.Image = imgBatman
slot1Name = "Batman"
Case Else
lblSlot1.Text = "Error. slot1value = " & slot1Value
End Select
End If
I have searched around for this, but I m very new to Visual Basic, and want to keep my code as simple as possible.