Public Shared Function FindControlByFieldName(ByVal frm As Form, ByVal name As String) As Object Dim t As System.Type = frm.GetType() Dim pi As System.Reflection.PropertyInfo = _ t.GetProperty(name, _ System.Reflection.BindingFlags.Public Or _ System.Reflection.BindingFlags.NonPublic Or _ System.Reflection.BindingFlags.Instance Or _ System.Reflection.BindingFlags.DeclaredOnly) If Not pi Is Nothing Then Return pi.GetValue(frm, Nothing) End If Dim fi As System.Reflection.FieldInfo = _ t.GetField(name, _ System.Reflection.BindingFlags.Public Or _ System.Reflection.BindingFlags.NonPublic Or _ System.Reflection.BindingFlags.Instance Or _ System.Reflection.BindingFlags.DeclaredOnly) If fi Is Nothing Then Return Nothing End If Return fi.GetValue(frm) End FunctionOnce added, the Form parameter is underlined which demonstrates an error. Anyone would know what I have to do when adding this function in a class to avoid the error? When I include it in my Form, I don't have any problem.