Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
This function gives compile error
Message
From
02/01/2005 23:25:33
 
 
To
All
General information
Forum:
ASP.NET
Category:
Class design
Title:
This function gives compile error
Miscellaneous
Thread ID:
00973737
Message ID:
00973737
Views:
49
I have a Function.dll which includes several function. I tried to add the following:
    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 Function
Once 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.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Next
Reply
Map
View

Click here to load this message in the networking platform