2、通过Reflection查看,代码如下:
None.gif Public Function GetControlByName(ByVal Name As String) As Control
None.gif
None.gif ' now, why would I put a "_" in front of the name?
None.gif Dim info As System.Reflection.FieldInfo = Me.GetType().GetField( " _ " & Name, _
None.gif System.Reflection.BindingFlags.NonPublic Or _
None.gif System.Reflection.BindingFlags.Instance Or _
None.gif System.Reflection.BindingFlags.Public Or _
None.gif System.Reflection.BindingFlags.IgnoreCase)
None.gif
None.gif If info Is Nothing Then Return Nothing
None.gif Dim o As Object = info.GetValue(Me)
None.gif Return o
None.gif
None.gif End Function
转载于:https://www.cnblogs.com/zqfleaf/archive/2006/11/15/560865.html