我试图让我的表单上的一些标签可见,但我不想使用很多if
语句,但由于某种原因,每当我放入Me.Controls(lbl).Visbel = True
for 或 do 循环时,它都会跳过整个循环。代码完全按照我想要的方式运行,直到我调用Dim lbl = Controls("Label" & counter_3)
整个类而不是在 From_load 私有子中调用错误。有时我可以让它工作,但只有一个标签可见
Dim chararray() As Char = word_list(random_word).ToCharArray
Dim lbl = "Label" & counter_3
For Each item In chararray
If item = Nothing Then
Else
word_list(counter_2) = item.ToString()
counter_2 += 1
End If
Next
For Each item In chararray
If item = Nothing Then
Else
counter_3 += 1
Me.Controls(lbl).Visible = True
MsgBox(item & " " & counter_3)
End If
Next
我也试过了。在这两个循环中都被完全跳过。我知道这一点是因为 MsgBox 没有出现。
Dim chararray() As Char = word_list(random_word).ToCharArray
Dim lbl = Controls("Label" & counter_3)
For Each item In chararray
If item = Nothing Then
Else
word_list(counter_2) = item.ToString()
counter_2 += 1
End If
Next
For Each item In chararray
If item = Nothing Then
Else
counter_3 += 1
lbl.Visble = True
MsgBox(item & " " & counter_3)
End If
Next