Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Public Function GetControlByName(ByVal Name As String) As Control
'now, why would I put a "_" in front of the name?
Dim info As System.Reflection.FieldInfo = Me.GetType().GetField("_" & Name, _
System.Reflection.BindingFlags.NonPublic Or _
System.Reflection.BindingFlags.Instance Or _
System.Reflection.BindingFlags.Public Or _
System.Reflection.BindingFlags.IgnoreCase)
If info Is Nothing Then Return Nothing
Dim o As Object = info.GetValue(Me)
Return o
End Function
Imports System.Windows.Forms
Public Class ReflectionInfo
Public Shared Function GetControlByName(ByVal Name As String, _
ByVal CurrentForm As Form) As Control
Dim info As System.Reflection.FieldInfo = _
CurrentForm.GetType().GetField("_" & Name, _
System.Reflection.BindingFlags.NonPublic Or _
System.Reflection.BindingFlags.Instance Or _
System.Reflection.BindingFlags.Public Or _
System.Reflection.BindingFlags.IgnoreCase)
If info Is Nothing Then
Return Nothing
Else
Return CType(info.GetValue(CurrentForm), Control)
End If
End Function
End Class