Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Validating on Overridable method
Message
From
05/09/2011 12:29:56
 
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01522449
Message ID:
01522736
Views:
22
>You could use Reflection. Simplified example:
Public Class BaseClass
>	Public Function DataEntry() As Boolean
>		Dim t As Type = Me.[GetType]()
>		Dim minfo As MethodInfo = t.GetMethod("InitializeWithRow", BindingFlags.Instance Or BindingFlags.[Public])
>		If minfo.DeclaringType.Name <> "BaseClass" AndAlso DoCheck() Then
>			Return InitializeWithRow()
>		End If
>		Return True
>	End Function
>
>	Public Overridable Function InitializeWithRow() As Boolean
>		Return True
>	End Function
>
>	Public Function DoCheck() As Boolean
>		'Decide whether to call InitializeWithRow()
>		Return True
>	End Function
>End Class
(Syntax not checked)

minfo.DeclaringType.Name will always be equal to the base class name. So, something has to be adjusted in there.
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform