04/09/10 15:49:41
>>818
Public Function FindControl2(ByVal ctl As Control, ByVal name As String) As Control
Dim myPropertyInfo As System.Reflection.PropertyInfo
Dim myObject As Object
myPropertyInfo = ctl.GetType().GetProperty(name _
, Reflection.BindingFlags.Instance _
Or Reflection.BindingFlags.NonPublic)
If Not myPropertyInfo Is Nothing Then
myObject = myPropertyInfo.GetValue(ctl, Nothing)
Return CType(myObject, Control)
End If
Return Nothing
End Function
for i as int32 = 0 to 10
findcontrol2(me,"textBox" & cstr( i) ).text="aheahe"
next