Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sub-classing Web Form question
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00696783
Message ID:
00696838
Views:
10
Hi Allan,

In VB.NET, the methods that you want to add your own code in the inherited class then you need to add a couple of attributes to the methods.

In the base class method, make sure the scope is NOT "Private". If only your inherited class will use the method, then use "Protected". You need to add the "Overridable" keyword. Then in the inherited method, use the "Overrides" keyword.
'In the Base Class
Protected Overridable Sub MyMethod()
End Sub

'In the Inherited Class
Protected Overrides Sub MyMethod()
End Sub
>Hi,
>
>I have created a sub-class of a web form ('clsSweepForm' in project 1).
>
>After creating a reference to the 'dll' from project 1 in project 2 - I am able to inherit the properties I created in 'clsSweepForm' - using 'WebForm1' in project 2.
>
>In other words, from Webform1, I can enter:
>
>
>Me.FormMode = "isAdding"    'where property FormMode was defined in 'clsSweepForm'
>
>
>Therefore, I am able to get at the properties of 'clsSweepForm' from WebForm1. Now, what I'd really like to do is do something that I have done in VFP for some time.
>
>In some of my VFP projects where similiar methods were required in multiple pages (i.e. Validate Input, Add a record, Delete a record, etc.) - I'd just create a form class and add these methods to the form class.
>
>For instance, I'd add a method called 'methodADD' in the form class. Then, in the VFP form based on this class, the method would be visible and I could enter the appropriate code.
>
>Is there a way to do this in VB.NET?
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Reply
Map
View

Click here to load this message in the networking platform