我正在尝试将字符串转换为对象(这是过程的参数)。我也试过Ctype但它没有用。
Public Sub procName(lbl1 as Label, lbl2 as Label, lbl3 as Label) 'suppose I have 10 labels
'long code here
for i as integer = 1 to 3
dim xL as label = DirectCast(Controls("lbl" & i.ToString), Label)
xL.text = i.Tostring 'I get the error here
next
End Sub
错误是:
你调用的对象是空的。